Question: how to use uses between child modules?

I am merging two separate modules  B,C to be child modules inside one main A module.

Now, I found the code breaks, because uses does not work any more.

Before merging, C module did uses B. But now this gives an error when both B,C sit inside one parent module.  An example make this easier to explain

restart;
interface(warnlevel=4);
kernelopts('assertlevel'=2):

A:=module()

   export B:=module()
     export foo:=proc()
         print("In B:-foo()");
     end proc;
   end module;

   export C:=module()
      uses B; #this cases problem
      export boo:=proc()
           foo();
      end proc;
   end module;
end module;

Error, (in A:-C) no bindings were specified or implied

Changing uses B; to uses A:-B; does not help. I get error Error, (in A:-C) `A` does not evaluate to a module

I also tried uses :-A:-B; , now this does not give error, but it does not work. i.e. when doing  A:-C:-boo() Maple does not end up calling foo() inside module B as expected.

One way to avoid all this, is not to use uses B inside the module and do this instead

A:=module()

   export B:=module()
     export foo:=proc()
         print("In B:-foo()");
     end proc;
   end module;

   export C:=module()      
      export boo:=proc()
           B:-foo(); 
      end proc;
   end module;
end module;

But it means I have to now change lots of code inside the C module, and add an explicit B:- everywhere

This is how it was before the merging

B:=module()
   export foo:=proc()
       print("In B:-foo()");
   end proc;
end module;

C:=module()  
  uses B;    #no problem now
  export boo:=proc()
      foo();  #this now uses B:-foo() automatically due to uses.
  end proc;
end module;

The above works. Now I can do C:-boo() and it works as expected.

The question is: How to make it work after moving both C and B inside one parent module so I do not have to change lots of code? I tried many things, but can't get it to work.

Maple 2021 on windows 10

Edit

Thanks for the answers below. I think I have to change my code then either way to add a prefix to the call. I actually always use the long form of the call for everything as in module:-function() but for one function, which I use so much everywhere, using the fully qualified name would make things hard to read.  This function converts Maple expressions to Latex after some filtering. Here is an example

cat(",toX(y),"' = f_0(",toX(f),")",toX(y),"+f_1(",toX(x),")",toX(g),"^n \\tag{2}, etc.....")

Now the function toX comes from one module, the one I had uses for it. Now I have to change the above to becomes

",module_name:-toX(f),"' = f_0(",module_name:-toX(x),")",module_name:-toX(y),"+f_1(",module_name:-toX(x),")",module_name:-toX(g),"^n \\tag{2}

Since my strings are very long as it is, (program generates Latex on the fly as it runs), this will make them even longer and harder to read.

But I can change all this in the editor, using global search and replace.

I was just hoping I do not have to just because I moved the modules all into one main module. I still do not understand why Maple does not allow uses when moving the modules inside one bigger module, but I guess this is by design.

Please Wait...