[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Strings as variable names
From: |
Johan Vromans |
Subject: |
Re: Strings as variable names |
Date: |
Mon, 28 Dec 2015 20:28:58 +0100 |
On Mon, 28 Dec 2015 18:49:30 +0100
David Kastrup <address@hidden> wrote:
> > I have always been frustrated by the fact that I can't (or thought I
> > couldn't) use underscores in variable names,
>
> Well, that is hopefully more or less documented though probably not
> everywhere.
NR refers to
http://www.lilypond.org/doc/v2.19/Documentation/learning/organizing-pieces-with-variables
which does not mention the quoted syntax, and explicitly disallows dashes
and underscores.
=== Suggested replacement text ===
The name of a variable must consist of alphabetic characters, underscores
and dashes. Underscores and dashes must always follow and be followed by an
alphabetic character. Also, the name of a variable may not be one of
LilyPond's predefined keywords.
These are valid variable names:
pieceIV
myMusic
alternate-one
big_loud_part
Examples of invalid names:
piece4 (numbers not allowed)
-my-Music (leading dash)
alternate--one (more than one consecutive dash)
example_ (ends with underscore)
A variable name may be enclosed in double quotes, e.g. "pieceIV" is
the same as pieceIV. When using quotes, the name may consist of any
sequence of characters. For example "My New Music Piece 14²" is a valid
variable but there is no quote-less way to refer to it.
"My New Music Piece 14²" = \new Staff {
\relative {
a'4 b c b
}
}
{
<<
\"My New Music Piece 14²"
>>
}
=== end of suggestion ===
> But really, \"violin1" is so much more ugly than \violinI or if you must
> \violin_I.
Let's consider this a matter of taste...
BTW, you can use unicode characters including numerals ☺ .
bella_melódia-① = { ... }
-- Johan
http://johan.vromans.org/seasons_greetings.html
- Re: Strings as variable names, (continued)
- Re: Strings as variable names, Werner LEMBERG, 2015/12/28
- Re: Strings as variable names, Johan Vromans, 2015/12/28
- Re: Strings as variable names, David Kastrup, 2015/12/28
- Re: Strings as variable names, Johan Vromans, 2015/12/29
- Re: Strings as variable names, Marc Hohl, 2015/12/28
- Re: Strings as variable names, Thomas Morley, 2015/12/28
- Re: Strings as variable names,
Johan Vromans <=
- Re: Strings as variable names, Simon Albrecht, 2015/12/28
- Re: Strings as variable names, David Kastrup, 2015/12/28
- Re: Strings as variable names, Simon Albrecht, 2015/12/29
- Re: Strings as variable names, David Kastrup, 2015/12/29
- Re: Strings as variable names, Kieren MacMillan, 2015/12/29
- Re: Strings as variable names, Werner LEMBERG, 2015/12/28
Re: Strings as variable names, Johan Vromans, 2015/12/28