lilypond-user
[Top][All Lists]
Advanced

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

Re: Still confused about context vs. new


From: lily-user
Subject: Re: Still confused about context vs. new
Date: Sat, 19 Jul 2008 08:46:28 +1000
User-agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.7 MULE XEmacs/21.4 (patch 21) (Educational Television) (i486-linux-gnu)

>> In the meantime, the distinction is explained in NR 5.1.2 Creating
>> contexts, although this section has not yet been reviewed in GDP so
>> maybe it could be improved.  Let me know to what extent it helps
>> you.  In any case I'll bear your comments in mind when I get to
>> that section.
Patrick> Yes, I had read that.  In fact, I've read all of the
Patrick> documentation.  Maybe it's just one of those things where you
Patrick> beat your face on it until you get it, and then review the
Patrick> documentation and can no longer figure out why it wasn't
Patrick> clear:(

I personally have *never* needed to use \new.  

\context implicitly instantiates a new context if the
one named doesn't yet exist, so \new is redundant, *except* where you
want multiple distinct contexts with the same name, or you're using
unnamed contexts (which, internally, is the same thing)

Distinct objects should (as a general rule) be named distinctly, so
that leaves the only place to use \new: when you want unnamed contexts.

Compare:

        \score {
                {
                \context Staff \relative c' { a b c }
                \context Staff \relative c' { a b c }
                }
        }

with

        \score {
                {
                \context Staff \relative c' { a b c }
                \new Staff \relative c' { a b c }
                }
        }
and

        \score {
                {
                \context Staff = "A" \relative c' { a b c }
                \context Staff = "B" \relative c' { a b c }
                }
        }

--
Dr Peter Chubb  http://www.gelato.unsw.edu.au  peterc AT gelato.unsw.edu.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia




reply via email to

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