Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3376

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

From Bill Rowe <readnews@sbcglobal.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: what's in a name? (legal and conventional constructions of identifiers)
Date 2011-06-29 21:40 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <iug659$9i1$1@smc.vnet.net> (permalink)

Show all headers | View raw


On 6/27/11 at 7:32 AM, alan.isaac@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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: what's in a name? (legal and conventional constructions of identifiers) Bill Rowe <readnews@sbcglobal.net> - 2011-06-29 21:40 +0000

csiph-web