From: James Stein on
No surprises if I execute this in a cell:

ClearAll [ g ];
SyntaxInformation [ g ]
g [ x_] := x;
g [ 3 ]


But if I now execute this in another cell:

SyntaxInformation [ g ] = {"ArgumentsPattern" -> {_, _}};
g [ 3 ]

SyntaxInformation [ g ]

ClearAll [ g ]
g [ 3 ]

SyntaxInformation [ g ]

the output will be as expected, but there is an ugly side effect:

In BOTH cells all calls "g [ 3 ]" now contain a red caret

following the "3", indicating a missing argument.

(I am using Mathematica 7.0.1 on Mac OS X 10.6.4, YMMV).


It seems to me that 'ClearAll' removes syntax information,

as I expected, but this removal is not communicated to the

Notebook front end. My experience is that the kernel must be

restarted in order to remove the erroneous red caret.


Is this a bug in Mathematica, or in my (mis?)understanding of
SyntaxInformation?