I noticed in object constructor I had to write _self:-name to refer to object own variable called name. But inside a another proc I can use just name without having to add _self:- to it. It also works when adding _self:-
Is this becuase constructor is special proc, and the object is not yet full constructed? Here is a MWE
export ModuleCopy::static:= proc( _self::person, proto::person, the_name::string, $ )
#Why this fails here, but not in process proc? Is it because of special
#case since done inside constructor?
export process::static :=proc(_self,$)
#here both cases work
The above works. But if I uncomment #print(name); inside the constructor, maple gives error
Error, static procedure `ModuleCopy` refers to non-static local or export `name::string` in surrounding scope
But this works with no error
But no such error when doing same thing inside a local static proc inside same module.
Is this special just for the constructor than one must use :-self ? Just wanted to make sure.