Question: how can child module call parent local proc, without making parent proc exported?

Here is short description of the problem with code MWE below.

Short version of the question

I want to change

parent:=module()
  local foo:=proc()
     NULL;
  end proc;

  local child:=module()    
     export boo:=proc()
        foo(); #call works as is
     end proc;
  end module;

end module;

To

parent:=module()
  local foo:=proc()
     NULL;
  end proc;

  local child:=module()    
     export boo:=proc()

         #now call no longer works. Maple wants foo exported
         #I want to add parent:- to the call to remind me where foo((
         #lives but do not want to make foo() in parent exported

         parent:-foo();

     end proc;
  end module;
end module;

Longer version of the question

I have a parent module with one child local module inside it. In the child module, there is a proc which wants to call parent's local proc named foo().

As is, the child module can just call the parent's local proc foo() by typing foo() without the need to do parent:-foo() this is because child module has access to parent local proc's and maple knows which foo() by searching the scope from bottom up.

The problem comes when I added a proc also called foo() (by mistake) in the child module without noticing there is one with same name in the parent's.

Now the call foo() will end up calling the child's module foo() and not the parent's foo() becuase that is the "closest" one with this name in the scope. All of this makes sense so far.

The problem comes when the child module wants to really call the parent's foo().

One solution is to change the call to parent:-foo() to explicitly says which foo() to call.

This however now fail, since the parent foo() is local ! And Maple when it sees call to parent:-foo() it now insist it be exported proc (even though the call is being made from inside, i.e. from the child).

I do not want to make the parent's foo() exported just so the child can call it.  I want to keep parent's foo() local, as it is meant to be used only inside the parent and by its children.

You might ask, why not then change the name of the child's foo() to some other name so it does not clash with the parent's local proc name. Yes, I can do this. But for large modules in different files with many procs(), there is a always a chance  a local proc can be added by mistake with happend to be the same name as one in the parent and having to manually keep checking names does not look like the right solution.

My question is: How can a child module call parent's local proc() explicitly, but without making the parent proc exported?  Is there is different syntax to use?

Here is a MWE

 

restart;
parent:=module()

  export main:=proc()
     child:-boo();
  end proc;

  local foo:=proc()
     print("in parent:-foo() proc");
  end proc;

  local child:=module()     
     export boo:=proc()
        print("in child:-boo() proc");
        foo(); #this works. It called parent's local foo()
     end proc;
  end module;

end module;

Now doing parent:-main() works as expected. Notice parent's foo is local to parent module.

Now I changed the child module and did this

parent:=module()

  export main:=proc()
     child:-boo();
  end proc;

  local foo:=proc()
     print("in parent:-foo() proc");
  end proc;

  local child:=module()
     local foo:=proc() #added this using same name by mistake
        print("in child:-boo()");
     end proc;

     export boo:=proc()
        print("in child:-boo() proc");
        foo(); #now this calls the child's foo() ofcourse. But it was meant to call the parents's
     end proc;
  end module;

end module;

The fix is to change the call from the child to becomes    parent:-foo() but now Maple will give an error saying parent does not export foo().

Since the child have access to parent's local proc's, is there a different way to tell Maple I want to call parent's foo() and not my own foo() without making parent's foo() exported? 

For example , in Python one call call parent's method expliclity using super().foo() 

Maple 2021.2

Please Wait...