bug-lilypond
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: The exact semantics of the new \new command?


From: Mats Bengtsson
Subject: Re: The exact semantics of the new \new command?
Date: Sun, 23 Apr 2006 12:41:23 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050927 Debian/1.7.8-1sarge3

OK!

I noticed that this new syntax isn't yet described in
"9.1.1 Creating contexts" and is not listed in Cameron's
TODO list for the document updates. Unfortunately, I don't
have much time to contribute to the docs for the moment,
but this seems like something that easily could be updated.

  /Mats

Graham Percival wrote:


On 23-Apr-06, at 2:50 AM, Mats Bengtsson wrote:

What, exactly, is the semantics of the \new <context> = <name> ...
syntax? As far as I understood the discussion leading to this
syntax, it should be equivalent to
\context <context> = <name>
if that context wasn't already created and it should
issue a warning if the context already existed.


IIRC, it was decided that no warning would be issued. This was to make the implementation easier; I believe that there was some mention of upcoming 3.0 syntax changes that would change \new and \context further, and thus it didn't make sense to spend a lot of effort on it right now.

As the following example shows (and the last example in
"More Stanzas", for example), what really happens is equivalent
to \new <context>, i.e. you get a new instance of the context
with some anonymous name. Also, no warning is issued.

\version "2.8.0"

\relative <<
 \new Staff = FIRST \new Voice { c1^"in FIRST" }
  % Should at least issue a warning:
 \new Staff = FIRST \new Voice { e1 e^"2nd incarnation of FIRST" }
 % Which of the above two will this one end up in?:
 \context Staff = FIRST \new Voice { g1 g g^"back in FIRST" }
>>


Disregarding the warning issue (in HWN's words, "Don't Do That"), this example works (if you rename the second FIRST to SECOND).

It seems that whoever updated the examples such as the
last example in "More Stanzas" rather had the impression
that
\new <context> = <name> ...
will always be equivalent to
\context <context> = <name> ...
which clearly isn't the case, so this is a problem both
in the implementation and the documentation and example
files.


I didn't think that \new was the same as \context, but I also don't claim to fully understand this issue. As far as I know, right now \new works well other than not giving warnings.

The issue with "More Stanzas" is that I was updating the docs during a music theory lecture, and (as always) I don't really know what I'm doing with vocal music. The two
\new Lyrics = "mainlyrics"
are obviously a mistake. I've changed the second one to \context, and it looks right to me.

Cheers,
- Graham



--
=============================================
        Mats Bengtsson
        Signal Processing
        Signals, Sensors and Systems
        Royal Institute of Technology
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

[Prev in Thread] Current Thread [Next in Thread]