I find that Mathematica's status-indication constants like $Failed, $Aborted, and $TimedOut are very useful, and would like to use them in my own code. Sometimes I'm tempted to create my own when developing packages, but that create context issues around where they're created, and prepending them with Global' all the time gets tedious.

So, it would be very helpful to have a list of all the $ constants that Mathematica uses, so that I can use them too. However, I have been unable to find such a list. Question 1: Does one exist?

Question 2: Any advice for creating similar constants that have a similarly global reach?

  • $\begingroup$ Names["System`$*"] will list all inbuilt symbols which start with $. $\endgroup$ – Patrick Stevens Sep 9 '15 at 21:00
  • $\begingroup$ Oh for heaven sakes. I should have thought of that! Thanks. $\endgroup$ – ibeatty Sep 9 '15 at 21:01
  • $\begingroup$ Alas, it appears that the three I mentioned above -- the only ones I've stumbled over -- appear to be the only status-type message symbols in that list, at least as far as I can tell from the names. All the rest seem to be variables like $Context. Oh well, back to defining my own. $\endgroup$ – ibeatty Sep 9 '15 at 21:04
  • $\begingroup$ The only reason $Failed is a status message is because there's widespread consensus that it should be used that way. You can define your own symbols and Protect them (or even set the Locked attribute) so that they can't be assigned a value. $\endgroup$ – Patrick Stevens Sep 9 '15 at 21:05
  • $\begingroup$ If I define them in a notebook, I guess I should explicitly create them in the Global context, so that they don't default to the package context, and can be accessed without an explicit context from anywhere. Concur? $\endgroup$ – ibeatty Sep 9 '15 at 21:07

Browse other questions tagged or ask your own question.