lilypond-devel
[Top][All Lists]
Advanced

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

Re: Naming _another_ lacking puzzle piece


From: Trevor Daniels
Subject: Re: Naming _another_ lacking puzzle piece
Date: Sun, 14 Oct 2012 08:19:55 +0100

Joe Neeman wrote Sunday, October 14, 2012 12:14 AM
>
> On Sat, Oct 13, 2012 at 2:29 PM, David Kastrup <address@hidden> wrote:
> 
>> \override  overwrites the last definition
>> \revert  throws it away/reestablishes the previous if not overwritten.
> 
> In other words, we have a "pop-push" and a "pop". In the context of
> Reinhold's email, you were suggesting (although perhaps not seriously)
> adding a "push". Now, I'm happy to have "push" and "pop," but I think
> "pop-push" is a bad interface for a stack. The reason that we have gotten
> away with it for so long is because our interface ensures that the stack is
> almost always empty anyway (since the only way to "push" is with \once, and
> that always pops immediately). Once we start talking about composability,
> the deficiencies of pop-push become clear.
> 
> So my proposed set of orthogonal commands would be push and pop (again,
> with more intuitive names). I also suggest adding clear for convenience.
> Everything else would be syntactic sugar on push and pop.

I would be happier with this change.  Why not just change the action of
\override to be push alone?  As its current implementation pretty well 
ensures all the stacks are empty, changing its action to be push rather than 
pop+push would have a limited effect on existing scores, wouldn't it?

> What isn't orthogonal is that you can't express, say, \temporary in terms
> of \override and \revert. If we switch to using push and pop instead of
> pop-push and pop, then push and pop become the orthogonal underpinnings of
> everything and \once, \temporary, and \undo become syntactic sugar. The
> sugar is then easy to explain to users because it can be expressed in terms
> of commands that they already know.
> 
>> What is "clear" supposed to be?
> 
> It empties the stack.
> 
>> Quite a few commands intended to be used "at bottom" have a
>> combination of overrides and reverts.  Having the reverts remove
>> everything to bottom of stack and the overrides not is not going to make
>> things more predictable.
> 
> I am proposing that \revert do a pop, not a clear. I would then change the
> definition of \oneVoice to do a clear rather than a pop.

That seems a clearer approach (NPI). 

>> > \override Something #'color = #green
>> > \override Something #'color = #red
>> > \undo\override Something #'color = #green
>> > go back to the pre-green color.
>>
>> Not useful.  This is primarily of interest when the outer and the middle
>> part are provided from different sources and don't know what the
>> respective other is, and if the middle part happened to be \override
>> Something #'color = #green for whatever reason, suddenly the scope of
>> the \undo would flip.
> 
> Ok, that's a good point. It still seems a little strange to me, though, that
> \undo\override Something #'color = #red
> will actually reverse the effect of
> \override Something #'color = #green

I think the point is that \undo will never be ostensibly be written with a
following \override but rather as \undo \voiceOne.  Its action then would
be to pop all the \overrides within \voiceOne, returning the state to
\voiceThree, \oneVoice, or whatever it was before \voiceOne was
called.

Even so, if the \undo\override did not exactly match the top of the stack 
it should throw a warning.

Trevor

reply via email to

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