1
$\begingroup$
SyntaxInformation[f] = {"ArgumentsPattern" -> {}};
f[] := 0;

After one ClearAll[f] or ClearAll["`*"], f remains black. It takes two to turn f blue, and it can't be in the same cell: just running ClearAll[f];ClearAll[f] is not enough. Yet one ClearAll is enough to clear FullDefinition[f].

In fact, the line f[] := 0; is extraneous; all that's needed is to define SyntaxInformation[f].

Is this a bug? Is there anything I can run once to turn everything blue?

$\endgroup$
3
  • 2
    $\begingroup$ Seems like a bug to me. I didn't look into this too much, but it looks like the front-end is informed about the symbol removal before the syntax-information stuff is updated. This probably confuses the front-end abojt the status of the symbol. As a workaround, clearing the syntax-information before clearing the symbol works for me: SyntaxInformation[f]=.; ClearAll[f] $\endgroup$
    – Lukas Lang
    Commented Jun 30, 2021 at 11:46
  • $\begingroup$ @LukasLang Can I enter something to clear all syntax information I've defined before a ClearAll["`*"]? $\endgroup$
    – H.v.M.
    Commented Jul 1, 2021 at 7:58
  • 1
    $\begingroup$ Something like Quiet[Unset@*SyntaxInformation@*Symbol /@ Names["`*"]] should do the job $\endgroup$
    – Lukas Lang
    Commented Jul 1, 2021 at 8:00

1 Answer 1

0
$\begingroup$

It's a bug. From Wolfram Technical Support: "I have reproduced the issue and have reported it to our developers."

Workaround, from the comments by Lukas Lang: SyntaxInformation[f]=.; ClearAll[f] or Quiet[Unset@*SyntaxInformation@*Symbol /@ Names["`*"]]; ClearAll["`*"].

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.