Peter Toye <[email protected]> writes:

> Is there a case for introducing scoped variables into Lilypond? 
>
> As I understand it (please correct me if I'm wrong), variables have to be 
> declared at the top of the document, before any music expression. I'm trying 
> to work on a document with many different scores, each if which is in its own 
> file. According to what I gather is best practice I use variables to hold the 
> basic music text: one variable for each staff. When engraving each individual 
> score, I need to put its variable declarations at the head of its file. But 
> when I want to gather them all together into a book or bookpart, this doesn't 
> work, so each score has to be edited to remove the definitions.
>
> One way round this would be to allow Lilypond variables to be defined
> within bookparts and/or scores, and to give them a scope confined to
> that section. See the following MNWE.

So what happens with

bla = c'
sc = \score { \bla }

\book {
  bla = f'
  \sc
}

There are similar considerations for defining and using bookparts
outside of books: basically the question is what scopes you even want to
be talking about, lexical or dynamical, and how the two would be
supposed to interact.

-- 
David Kastrup

Reply via email to