Functions in a different context are replaced with infix forms of their namesake in System`
It seems like the StandardForm (default for output) of Times
in any context (or Plus
, etc) is with the * and + symbols.
But your assumption isn't wrong I think, the symbols * and + are mapped to System Times and System Plus. Try
PrependTo[$ContextPath, "blo`"];
blo`Times[a_, b_] := 8;
FullForm@MakeExpression[RowBox[{"a", "*", "b"}], StandardForm]
I think that this goes against Mathematica policy that "StandardForm generates output that gives a unique and unambiguous representation of Mathematica expressions, suitable for use as input"
The problem seems to be with ToBoxes
:
Outer[#1[#2[a,b]]&,{ToString[#,OutputForm]&,ToBoxes},{Times,foo`Times}]
(*
==> {{"a b", "foo`Times[a, b]"}, {\(a\ b\), \(a * b\)}}
*)
Note that Times
and foo`Times
are still different in that for Times
, no *
is generated.
When typing to the kernel directly, OutputForm
is used, and foo`Times[a,b]
gets printed:
In[1]:= {Times[a,b], foo`Times[a,b]}
Out[1]= {a b, foo`Times[a, b]}