Robby Villegas here shows a nice way to see all the types associated with a symbol. He sets a symbol, valueTypes
, to an explicit list of the values types in version 3.0 of Mathematica (I took off his dollar sign (he wrote $ValueTypes
) so as not to give the false impression that valueTypes
is provided by the system --- Robby just writes it out from some other source, maybe just deep knowledge or the source code):
valueTypes = {Attributes, DefaultValues, DownValues, FormatValues,
Messages, NValues, OwnValues, Options, SubValues, UpValues};
Through[valueTypes[Unevaluated[E]]]
{{Constant, Protected, ReadProtected}, {}, {}, {HoldPattern[MakeBoxes[E, _]] :> "\[ExponentialE]"}, {HoldPattern[E::usage] :> "E is the exponential constant \[ExponentialE] (base of natural logarithms), with numerical value \[TildeEqual] 2.71828."}, {}, {}, {}, {}, {}}
This was way back in version 3. We're at version 10.2, now, and I wonder whether any new "value types" have been added to the system.
Is there an authoritative list of these types, either in the documentation or in a system-supplied symbol I can inspect?
The question "Copying one symbol into another" is about a similar, but non-identical problem. Why is my question not a duplicate? The solution to copying involves the function Language`ExtendedDefintion
, which explicitly lists the following value types:
In[1]:= Language`ExtendedDefinition[f]
Out[1]= Language`DefinitionList[HoldForm[f] ->
{OwnValues -> {}, SubValues -> {}, UpValues -> {},
DownValues -> {}, NValues -> {}, FormatValues -> {},
DefaultValues -> {}, Messages -> {}, Attributes -> {}}]
Note that it does not list Options
. Options are instead stored within DefaultValues
for some reason:
In[2]:= Options[f] = {a -> 1};
In[3]:= Language`ExtendedDefinition[f]
Out[3]= Language`DefinitionList[HoldForm[f] ->
{OwnValues -> {}, SubValues -> {},
UpValues -> {}, DownValues -> {}, NValues -> {},
FormatValues -> {}, DefaultValues -> {HoldPattern[Options[f]] -> {a -> 1}},
Messages -> {}, Attributes -> {}}]
This shows that Options
and Default
are somehow different from the other value types, and they are both stored inside DefaultValues
. Yet they still fit the description of "values associated with a symbol" (and are listed by Definition
). I would like to have a full list of such value types, including Options
and Default
.
Language`ExtendedDefinition
from related question give you the answer to whether there is an authoritative list? "Access" versus "access & storage" (of symbol values) seems a minor distinction. The second sentence is the reason people are not encouraged to delete duplicates, because they provide different routes to the same answer. The actual questions posed in duplicates often reflect the views of different people who don't completely understand the issues at hand (or why would they ask?).... $\endgroup$