lilypond-devel
[Top][All Lists]
Advanced

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

Re: \once \revert


From: David Kastrup
Subject: Re: \once \revert
Date: Sun, 21 Aug 2011 11:30:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Reinhold Kainhofer <address@hidden> writes:

> On So., 21. Aug. 2011 02:33:06 CEST, Carl Sorensen <address@hidden> wrote:
>> My thought for the architecture is to have two sets of properties -- the
>> context set and the \once set.
>
> That's exactly what I was about to propose, too. override basically
> sets the default, vbut a once always always takes precedence. You
> don't have to worry about restoring the old value (which one? as those
> examples highlight) at the end of the timestep, you just have to clear
> the once value.
>
>> When \override x=3 is received, it's put on both the \once set and the
>> context set.
>
> I wouldn't go that far. I would say that a once always overrides all
> overrides.

Should \once \override Staff.x be able to override \override Voice.x ?
Presumably not, I suppose that every context would have its own \once
value.

I have actually considered giving once absolute priority.  The reason I
have chosen against this is that if a user writes
\override x=2 music \revert x
then he has a reasonable expectation that music will get typeset with a
value of x=2 when music itself does not contain any overrides or
reverts and the override x=2 happens directly before music.

So I did not want a preceding \once\override x = 3 issued by different
code be able to seep beyond the following explicit \override.

This is of course, a judgment call.  I chose to have \override and
\once\override display an immediate action, and \revert only display an
immediate action if the corresponding \override is visible at the
moment.  This is actually a similar problem space to that of nested
properties: with nested properties, several different overrides can be
visible at the same time (after overriding in sequence x, x.y and x.y.z,
the visible x is a composition of all three overrides), so I am focused
on creating semantics that keep straight to the stack order of the
input, even though revert may have effects beyond the top of the
visibility stack.

>> \revert means "apply the revert to the context set.   If the \once set is
>> not empty, also apply it to the \once set."
>
> \once\revert would simply set the once value to the second-to-last
> value of the override stack.

\set Staffgroup.x = 2
\override Staff.x = 3
\override Voice.x = 4
\once\revert Voice.x   ; where is x now?
\revert Staff.x        ; where is x now?
[wait ...]             ; where is x now?

Since the current semantics of the implicit revert for \once\override
are based on "would simply set" and the results get quite surprising if
the stack does not do the programmer of staying unchanged anywhere else,
I am by now quite wary concerning sentences containing the string
"\revert would simply set".

-- 
David Kastrup




reply via email to

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