lilypond-devel
[Top][All Lists]
Advanced

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

Re: Default action (give just a warning?) of non-defined variables


From: Bernard Hurley
Subject: Re: Default action (give just a warning?) of non-defined variables
Date: Mon, 09 May 2005 16:45:40 +0100

This is a problem in all programming languages - what to do with
undefined variables. There are 3 common solutions:

1) Stop with an error message
2) Ignore any statements that contain the variable and optionally issue
a warning.
3) Assume a "default" value (e.g. "{}") and optionally issue a warning.

For very small examples (2) and (3) seem to be useful, but IMHO they end
up more nuisance than they are worth and make typos very difficult to
find (e.g. if you typed \MyWondsA instead of \MyWordsA). Of course you
could always read the warnings but anyone who seriously makes use of a
feature like this will end up with so many warnings that it will be
difficult to see which are informative and which are not.

        /Bernard

On Mon, 2005-05-09 at 17:40 +0300, Heikki Johannes Junes wrote:
> Would there be any sence if the default action of a non-defined variable
> would be `give just a warning'? I would like to do the following
> 
> % mysong.ly
> % \global is not defined
> myMusic = { c4 d }
> myWordsA = { Hel- lo }
> myWordsB = { fel- low }
> % \myWordsC, \myWordsD, and \myWordsE are not defined
> \include "songtemplate.ily"
> 
> % songtemplate.ily
> \score {
>    \new Staff <<
>       \context Voice = myvoice { \voiceOne << \global \myMusic >> }
> 
>       \context Lyrics = myvoiceA { s1 }
>       \context Lyrics = myvoiceB { s1 }
>       \context Lyrics = myvoiceC { s1 }
>       \context Lyrics = myvoiceD { s1 }
>       \context Lyrics = myvoiceE { s1 }
>       \context Lyrics = myvoiceA \lyricsto myvoice \WordsA
>       \context Lyrics = myvoiceB \lyricsto myvoice \WordsB
>       \context Lyrics = myvoiceC \lyricsto myvoice \WordsC
>       \context Lyrics = myvoiceD \lyricsto myvoice \WordsD
>       \context Lyrics = myvoiceE \lyricsto myvoice \WordsE
>    >>
> }
> 





reply via email to

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