[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Scoped variables
From: |
David Kastrup |
Subject: |
Re: Scoped variables |
Date: |
Sun, 03 Nov 2019 15:24:10 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Peter Toye <address@hidden> 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