I was surprised to find out the names of arguments of a function definition are not "temporary name/formal name"
a=1;b={1,2};c="abc";
x;
f[lzy_]:=lzy+1
Names["Global`*"]
(* answer is {"a", "args", "b", "c", "dims", "f", "lzy", "x"} *)
this recovery makes me feel unsafe and confuses me —— why a symbol to the left of the = will be admitted to a Symbol. As far as my gut feeling goes, "right value" should not be allocated memory.
and i did more tests i found almost wherever you use a new symbolic name, that name will appear in the output of Names[]. (for example, i call f[ssssss], then ssssss will appear in Names[])
so how to understand is a question for me, and another question, will this phenomenon cause some problems in some cases especially for newbie? I know in simple case will not have problems(because delayed-equal :=) as following
lzy=777
f[1](*ans is 2 not 778*)
Names[], it does not have any "values" assigned, which you can see with?lzy. Furthermore, evaluate justabcdefg, outside any function or definition or whatsoever. After the evaluation, it will appear inNames[], even though you did nothing with it. – Domen Jan 17 '23 at 20:13