# All value types for a symbol?

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 LanguageExtendedDefintion, which explicitly lists the following value types:

In[1]:= LanguageExtendedDefinition[f]

Out[1]= LanguageDefinitionList[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]:= LanguageExtendedDefinition[f]

Out[3]= LanguageDefinitionList[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.

• Related: Copying one symbol into another – jkuczm Jul 31 '15 at 13:48
• Doesn't LanguageExtendedDefinition 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?).... – Michael E2 Aug 1 '15 at 13:33
• ...Their different views can be helpful to others who search for solutions to problems that have the same answer. In your case, you already have eight upvotes, a considerable reward, and there is no penalty if the community marks the question a duplicate. Sometimes a question is literally an exact duplicate and it receives no upvotes. Other times, the questions should be linked and the community still values it. But it's not clear to me whether you're disagreeing with the close-votes or clarifying why you asked in the first place. – Michael E2 Aug 1 '15 at 13:33
• @Michael I was asked to edit my question and explain why I thought it wasn't a duplicate. I struggled a bit to express why I thought not, and you've added good clarity that the value of the question is that it adds another path to the answer, though the two paths are close. There is another point on which I now have more clarity, implied by your question, and I didn't have that clarity when I wrote my edit. That's on the difference between "closed" and "deleted." I would not object to the question's being closed, but I don't think it should be deleted if it can still help others. – Reb.Cabin Aug 2 '15 at 1:33
• I hijacked your question a bit. :-) Please check it and just revert if you disagree. – Szabolcs Aug 3 '15 at 15:56

Thanks to the link to "Copying one symbol into another" in jkuczm's comment, I found a partial answer with LanguageExtendedDefinition. For instance:

LanguageExtendedDefinition[Log]

LanguageDefinitionList[Log->{
OwnValues->{},
SubValues->{},
UpValues->{},
DownValues->{},
NValues->{},
FormatValues->{HoldPattern[MakeBoxes[Log[BoxFormb_,BoxFormz_],TraditionalForm]]:>RowBox[{SubscriptBox[log,MakeBoxes[BoxFormb,TraditionalForm]],(,MakeBoxes[BoxFormz,TraditionalForm],)}]},
DefaultValues->{},
Messages->{HoldPattern[Log::usage]->Log[z] gives the natural logarithm of z (logarithm to base e). Log[b,z] gives the logarithm to base b. },
Attributes->{Listable,NumericFunction,Protected}}]


I say "partial" only because there is a slight mystery: in my notebook, I had to actually evaluate the symbol Log before its Messages attribute showed any value. Small point.

• So the answer to your posted question is really that nothing has changed since Villegas wrote his paper? – m_goldberg Jul 31 '15 at 15:51
• Looks like nothing has changed since V 3.0, which is remarkable. The implied bigger question was having a way to tell what all the attributes of a symbol are so that I can write programs to manipulate them (metaprogramming). – Reb.Cabin Jul 31 '15 at 19:59
• Just one issue to keep in mind (maybe related to the missing Messages, too): Attributes of built-in functions can be misleading unless you evaluate the function to force auto-loading of missing information. See here. So in other words, you can't always get accurate information about the language before actually using it... – Jens Jul 31 '15 at 22:00
• There's also Options, which you mentioned in the question but LanguageExtendedDefinition doesn't show. They show up in the DefaultValues for some reason ... Your original list was more complete than this one. – Szabolcs Aug 3 '15 at 15:37
• BTW this also answers why this probably should NOT be considered a duplicate. While LanguageExtendedDefinition is useful for copying everything associated with a symbol, it doesn't trivially show us what sorts of things may potentially be associated with a symbol. A naive use of this function didn't return Options`! – Szabolcs Aug 3 '15 at 15:38