5.112 Using short name for a proc inside nested modules instead of long name

There was a case where I was making lots of calls from many places to one specific proc inside a module. I did not want to keep using the long name each time.

the command alias did not work. After some trial and error, found that using use works. Here is the solution. First this is the original layout

restart; 
 
A:=module() 
   export B:=module() 
        export foo:=proc() 
            print("in A:-B:-foo()"); 
        end proc; 
   end module; 
 
   export C:=module() 
      export boo:=proc() 
              print("in A:-C:-boo()"); 
              A:-B:-foo(); 
      end proc; 
   end module; 
end module;
 

In the above, the goal is replace A:-B:-foo(); with just foo() and have it bind to A:-B:-foo(); automatically.

This is done by modifying the above to

restart; 
A:=module() 
   export B:=module() 
        export foo:=proc() 
            print("in A:-B:-foo()"); 
        end proc; 
   end module; 
 
   use foo=A:-B:-foo in #add this line here 
   export C:=module() 
      export boo:=proc() 
              print("in A:-C:-boo()"); 
              foo(); #now can just use the short name 
      end proc; 
   end module; 
   end use; #add this line here. 
end module;
 

Wrapping the whole module where the short name is used worked.

Any module that needs to use the short name, can do the same. This solved the problem.