So, in an attempt to help out Fabian with his question, I did what I often do, and created a new symbol in the Pillsy`
package that I could play with. Since it was in a package I control completely, I thought, "Hey, I can just call it Times
!". I was really surprised when this happened:
In[3]:= Pillsy`Times[a, b, c]
Out[3]= a * b * c
It looks like Mathematica uses just the symbol name in determining whether to replace something with infix syntax, without paying attention to the context. However, I'm fairly sure I've never seen it happen before and I don't recall coming across it in the documentation. Evidently specifying InputForm
shows you the whole thing:
In[4]:= Pillsy`Times[a, b, c] // InputForm
Out[4]= Pillsy`Times[a, b, c]
This is in contrast to the InputForm
for System`Times
.
Is this an intentional feature (it's hard to imagine otherwise), and if so, how does it interact with things like MakeBoxes
, MakeExpression
and Format
?
Also, how do you avoid being burned by it? I'm a little alarmed that my assumption that a * b * c
is the same thing as System`Times[a, b, c]
is unfounded, even in the absence of changes to $Post
and the like.