Adding a null character to a name, shouldn’t aﬀect it’s interpretation:
However, when doing the same thing in a procedure, this same behavior doesn’t seem to apply:
What am I missing?
Well, you are missing the following (cf. online help page of cat):
”Note that if the result of cat is a name, then it is in fact a global name, even though there might be a local variable of the same name currently active.”
”This allows you to make global assignments from within procedures. It illustrates the fact that only global names are returned by cat.”
(the latter being the comment on the last example of that online help page). Thus we have in turn:
Actually you’re not adding anything to the name. But you can’t construct a local variable inside a procedure. The constructed name refers to the global variable x, not the local variable of the procedure. See my Maple Advisor Database page ?Constructing_names_of_local_variables_and_formal_parameters (http://www.math.ubc.ca/~israel/advisor):
The reason for this behaviour is connected to the way the Maple kernel processes procedure deﬁnitions. Internally, names are used for reference to global variables, but not local variables or formal parameters. For example:
> test3:= proc(x) local v; v:= x+g end: > pointto(disassemble(addressof(eval(test3)))); LOC := args + g
Thus in the internal version of the procedure deﬁnition, the local variable name v is replaced by LOC, and the formal parameter name x is replaced by args (more precisely, these are special constructions which Maple interprets as references to the ﬁrst local variable and the ﬁrst formal parameter). If a name is only produced when the procedure is executed, these replacements do not occur and the name is interpreted as a global variable.