[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-devel
Subject:    Re: possibility of merging \override and \set (was: Naming _another_ lacking puzzle piece)
From:       Reinhold Kainhofer <reinhold () kainhofer ! com>
Date:       2012-10-14 16:18:19
Message-ID: 507AE5CB.4080208 () kainhofer ! com
[Download RAW message or body]

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, reinhold@kainhofer.com, 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



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic