Re: Bug in Lilypond

David Kastrup <[email protected]> Sun, 02 Aug 2026 09:36:43 +0200
Newsgroups gmane.comp.gnu.lilypond.bugs
Organization Organization?!?
Message-ID <[email protected]>
Werner LEMBERG <[email protected]> writes:

>   https://lilypond.org/doc/v2.26/Documentation/notation/multiple-scores-in-a-book
>
> where you can find the following.
>
>   By design, you cannot define variables within a ‘\book’ or
>   ‘\bookpart’ block (the same is true for ‘\score’, by the way);
>   [...]
>
> There is no bug; it is a parser restriction by design.  The
> documentation also shows a solution how to circumvent it, and as
> you've found out, Scheme code can also be used as an alternative.

To be fair, it isn't a parser restriction as much as an overall design
restriction.  The parser could easily be made to accept assignments
there if there were an acceptable way to make them do something
sensible.

You don't want assignments in books/bookparts to bleed outside of
books/bookparts or you will not be able to sensibly arrange them.  So
any solution here would need to introduce a scoping design.

Variables are stored inside of parser modules which are used globally.
You'd need nested parser modules to get around that.  How are they going
to interact with local paper blocks and local layout blocks?

In contrast to books/bookparts, I find it more defensible that there are
no score-local assignments.  After all, something like c=4 is a vaiid
music expression.

-- 
David Kastrup