lilypond-devel
[Top][All Lists]
Advanced

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

Re: possibility of merging \override and \set (was: Naming _another_ lac


From: Reinhold Kainhofer
Subject: Re: possibility of merging \override and \set (was: Naming _another_ lacking puzzle piece)
Date: Sun, 14 Oct 2012 18:18:19 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1

On 14/10/2012 17:46, Janek Warchoł wrote:
> As for (2), i see that there are three operations that can be
> performed on stack: push, pop and clear. 

Please, can we get away from thinking in terms of implementation details
and instead think of the use cases:

1) Just set a property (grob or context property) to a certain value,
don't worry about previous values
2) Set a property to the defaults
3) Temporarily set a property to a new value, being able to switch back
after a while
4) Switch back to a previous value

To implement those, only 3) and 4) need a stack or some other form of
storing previous values, but even that is not important to the user 
(lilypond users as well as developers simply using the provided API to
modify grob properties).

\set and \unset (for context props) currently do 1) and 2), \override
currently more or less does 1), \revert does 4), and only the scheme
function make-grob-property-override does 3)


The name "override" to me implies that there a value in force, but one
temporarily overrides its effect with something else, so this would
suggest it for use case 3). Also see the documentation string of
make-grob-property-set (which is called by \override):
"Make a @code{Music} expression that sets @var{gprop} to @var{val} in
@var{grob}.  Does a pop first, i.e., this is not an override."

So even the documentation for \override says that it is NOT an override...


My suggestion for the functions performing those four basic operations are:

1) \set    (most current uses of \override by users are really meant as
\set)
2) \clear (replaces current \unset, some of the \revert calls)
3) \override  (only needed when you need to switch back to previous value)
4) \restore

Of course, context properties currently don't have any history (i.e. no
stack), except for handling \once\set in the iterator, so this would
need to be implemented.

Cheers,
Reinhold

-- 
------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://www.kainhofer.com
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 * http://www.fam.tuwien.ac.at/, DVR: 0005886
 * Edition Kainhofer, Music Publisher, http://www.edition-kainhofer.com




reply via email to

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