Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: what's in a name? (legal and conventional constructions of identifiers)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119899] Re: what's in a name? (legal and conventional constructions of identifiers)
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 28 Jun 2011 07:57:36 -0400 (EDT)

On 6/27/11 at 7:32 AM, alan.isaac at gmail.com (Alan) wrote:

>>http://reference.wolfram.com/mathematica/tutorial/BasicObjects.html

>Thank you. That provides extra info, which imo should be linked from
>the DefiningVariables documentation.  I note that it does not define
>"letter-like form" and still does not warn users not to use
>underscores in variable names (which is a known common mistake of
>newcomers).

The link above is a subsection of the overview of the
Mathematica language structure. It is not complete by itself.
Other portions of the documentation describe usages of certain
characters such as the underscore which have special meaning in Mathematica.

>In terms of my question, it also does not (directly) address the
>question of convention that I raised. It is often desirable to break
>names into parts with a special symbol. (E.g., where many languages
>would use an underscore.) I'm guessing from what I've seen that
>users most often introduce symbols of the form prta$prtb. An
>alternative practice (that I actually have not seen in use, but I'm
>a neophyte) would be to use contexts: prta`prtb.  I find the latter
>a bit harder to read as a single name; are there other
>considerations?

Using a $ is allowed. Using a backquote character would not be
allowed. This is already being used as a separator when defining
contexts. That is prta`prtb would be looking for looking for
prtb in the context prta context and would not be seen as single variable.

My practice for naming variables is to use camel case and to
start names with a lower case character. This results in
something easy to read, consistent with Mathematica naming
requirements and is guaranteed not to have a conflict with
built-in symbols.



  • Prev by Date: Re: NSolve...
  • Next by Date: Re: what's in a name? (legal and conventional constructions of identifiers)
  • Previous by thread: Re: what's in a name? (legal and conventional constructions of identifiers)
  • Next by thread: Re: what's in a name? (legal and conventional constructions of identifiers)