lilypond-devel
[Top][All Lists]
Advanced

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

Re: \bookpart and variables


From: Werner LEMBERG
Subject: Re: \bookpart and variables
Date: Mon, 09 Feb 2015 22:04:51 +0100 (CET)

>> So I think that your comparison is not completely valid, since
>> lilypond's `variables' are obviously expanded at a different time
>> than Scheme assignments.
> 
> No, they aren't.  This is not due to a difference between LilyPond
> and Scheme.  If you override with #notecolor you'll again get two
> different colors.  But #(lambda (grob) notecolor) is called at
> iteration time, and at that time the second assignment to notecolor
> has already happened.
> 
>> Is this documented somewhere?
> 
> That iteration and parsing happen at different times?  It's not all
> that surprising.

Believe it or not, it *is* surprising.  You have to stumble upon nasty
side effects to start thinking about the issue.  Being a long-term
user and developer of lilypond, even I skipped the `fine print' until
now.

> We don't allow assignments inside of music expressions either, and
> again the reason is not as much that it wouldn't be possible to
> allow them there, but rather that people would be surprised that
> "reassigning" a variable inside of music will affect previous uses
> of it and not be in any conceivable way synchronized with the "flow"
> of music.

You are correct, of course, but this is not obvious at a first glance.
Could you add a corollary of our e-mail exchange on this topic to the
documentation?  Perhaps a section `When does variable expansion
happen?'...


    Werner



reply via email to

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