Question: is this expected name resolution issue?

 

If one refers to a name in Maple, I thought it will look at the global context to find it. So when one does latex(....) then this is assumed to be the system latex command. No need to do :-latex()

But if there is local variable in Object class called latex, why then is object:-latex gets confused with global Maple command latex()?  Here is an example

module ode_class()
      option object;
      local latex::strring :="";

      export init::static:=proc(o::ode_class)
        o:-latex:= latex(1/2,output=string);
      end proc;
end module:

my_ode:=Object(ode_class): 

Error, static procedure `ode_class:-init` refers to non-static local or export `ode_class:-latex::strring` in surrounding scope
 

ofcourse easy to fix, I just replace the RHS latex(1/2,output=string);  with :-latex(1/2,output=string); 

But my question why is object:-latex := latex(...)  makes Maple think the latex in the RHS is the variable name in the class, when it does not have the  object:- prefix?  Is this expected  behaviour in Maple? 

But now I am starting to worry that each maple command/function/name used inside the Object needs  :- added to it, just in case of a current or future name conflict with local object variables names.

 

 

Please Wait...