Replies: 2 comments 3 replies
-
I asked this because this kind of conversion happens inside the GraphicsBox routines. |
Beta Was this translation helpful? Give feedback.
-
I don't understand the question, but I will make some general observations. From the beginning, the difference between a Lisp-like interpreter string and a Lisp-like symbol has been muddled and muddied. It's one of those things like using "leaf" for "element" and "apply" for "eval" (and probably there are other things like that too). It doesn't help that the term "Symbol" in WMA is overloaded. It can mean a character symbol, or a variable symbol (as in find "x" in the equation ...). Also the notion of a variable binding in the Mathics code is probably lacking or muddled, so the Mathics Symbol class is a bit odd. We have been trying to unmuddy things. First we added Symbol definitions for a lot of the Built-in Symbols rather than write Symbol("xxx") everywhere. Next we disallowed the looseness of having a string in the Head name in (compound) Expression creation. However there are way too many areas where strings are used where symbols would have been used traditionally in a Lisp-like interpreter. I just chalk it up to inexperience and ignorance. But there is a lot of code like that, the WMA language has lots of details, if not also subtleties, and these subtleties have been coded in without describing what's going on. So you don't know if it was done that way because of ignorance or because there was a particular intent. And when it is of a particular intent, since you don't know what the intent is, it is hard to assess if there is a better way to do it. So keeping this in mind, I have been trying to tread lightly. That said, I can say there have been places where I haven't fully appreciated what was going on and I have made mistakes here and there. The trend though has been to use Lisp-like symbols (the Mathics Symbol class) when that is what is meant. That is, it has been more and more used when we need a fully-qualified name in the System namespace, and not the string of characters that are used to display that symbol. It occurs to me if Lisp had called this kind of thing a name there might have been a lot less confusion. |
Beta Was this translation helpful? Give feedback.
-
This is something that still I do not understand, since v 1.0: except for (I guess) exactly
43 cases:Symbol`True
-> True (bool)Symbol`False
-> False (bool)Symbol`Null
-> None-> This depends on the number format (Machine complex vs Precision complex)Symbol`I
-> 1I do not see a reason to convert a
Symbol
object (which are Python objects) to another thing, like astr
. TwoSymbol
s can be readily compared asa is b
ora == b
which are equivalent forms. So, for instance, why convert them tostr
and then compare string values? If we want the name of the symbol, we can just ask for it (a.get_name()
).Also, this method has a parameter (
evaluation
) that allows us to convert them into numbers if there is a numeric value associated. But again, I feel that this is misleading, and could be better achieved aseval_N(a, evaluation).to_python()
Beta Was this translation helpful? Give feedback.
All reactions