Mathematica Version 11.2 desktop / Windows 10 Pro 64-bit
(* Assume y is undefined. *)
(* ?y and ??y leave y undefined. *)
?y
Information::notfound: Symbol y not found.
??y
Information::notfound: Symbol y not found.
(* AtomQ[y] has a side effect of defining y. *)
In[3]:= AtomQ[y]
Out[3]= True
In[5]:= ??y
Global`y
Why does AtomQ[y] define y?
Is this "By Design" i.e. a carefully thought out deliberate feature?
One would think that if y is not defined, AtomQ[y] would output this as an error.
Why else would one be using AtomQ[y] unless they thought y was already defined.
It seems like a dangerous side effect which makes debugging a nightmare.
Is there a property of the Kernel to enable or disable functions like AtomQ from defining symbols?
In general, which built-in functions leave symbols undefined and which do not?
Thanks in advance.
Definition[y]
returnsNull
, if you haven't giveny
any definitions or attributes, even though the name"y"
is added to the"Global`"
context. $\endgroup$foo[bar]
puts both offoo
andbar
into the name space, in whatever is the currentContext
. But it does not mean either one has become "defined' in the sense of havingDownValues
or the like associated to them. $\endgroup$y
creates the symboly
. $\endgroup$