# Can UpValues (as well as other "*Values") always be converted to DownValues?

As this post has discussed, UpValues are certainly useful, and as this post has discussed, g /: f[g[x_]] := h[x] is not equivalent to f[g[x_]] := h[x], but that's not the point. It appears that other languages don't provide the alleged UpValues in general. So, my question is: can UpValues and other *Values all always be converted to DownValues (rather than asking for those distinctions)? And if not, does this mean that one can never implement the same functionalities in MMA's competitive products (like Maple and Mathics)?

• Sometimes symbols to which you want to attach DownValues are Protected and/or Locked. Feb 28, 2023 at 19:50
• Does it make sense to ask if OwnValues and SubValues can be converted to DownValues? Feb 28, 2023 at 20:22
• Not an answer to the question, but... section 9.7 of the Maple Programming Guide shows an example that essentially uses up-values. Mar 1, 2023 at 2:34
• @JasonB. (*x=.;*)LanguageExtendedFullDefinition[Globalx] gives LanguageDefinitionList[x->{OwnValues->{},SubValues->{},UpValues->{},DownValues->{},NValues->{},FormatValues->{},DefaultValues->{},Messages->{},Attributes->{Protected}}]; I think that other values are as important as downvalue. Mar 1, 2023 at 4:16
• @user688486 - I don't know what that printed mess is supposed to add to the discussion. Say I define an OwnValue via x=14. What does it mean to "convert" that to a DownValue? Mar 1, 2023 at 13:02

This is not an answer but a comment with image.

Certainly the UpValues can be converted to DownValues and the SubValues can be curried to DownValues manually, but then we mess up the bindings of symbols.

Before embracing associations I usually used the DownValues, UpValues and SubValues to store data.

Although there is no native OOP in Mathematica, we can treat certain symbols e.g. class as class like,

masterOf[class]^=...
servantOf[class]^=...
isProtected[class]^=...
class["some instance"]=...
...


For example, the GR packages xAct* use this method to manage relations between geometric objects

So UpValues is quite useful to make the dependencies of symbols more structured.

But with the more powerful Association and the interface Dataset, we can free ourselves from the cumbersome symbol management.