lilypond-user
[Top][All Lists]
Advanced

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

Re: \set vs \override


From: Joe Neeman
Subject: Re: \set vs \override
Date: Sat, 21 Nov 2009 08:44:43 -0800

On Sat, 2009-11-21 at 17:22 +0100, David Kastrup wrote:
> There is a chapter "set vs override" in the manual.
> 
> I am afraid that I fail to grasp the difference from the chapter.
> 
> It says: "There are actually two different kinds of properties."
> 
> But then it says
> 
>     Context properties can change value over time while interpreting a
>     piece of music; `measurePosition' is an obvious example of this.
>     Context properties are modified with `\set'.
> 
> So far so good.
> 
>     There is a special type of context property: the element
>     description.
> 
> If the element description is a _special_ type of context property, that
> would imply that there is just _one_ different kind of properties.  It
> completely fails to mention _what_ makes the element descriptions
> special and not settable with \set.
> 
>     These properties are named in `StudlyCaps' (starting with capital
>     letters).  They contain the `default settings' for said graphical
>     object as an association list.  See `scm/define-grobs.scm' to see
>     what kind of settings there are.  Element descriptions may be
>     modified with `\override'.
> 
> So why can't we use \set with element descriptions?  And where is the
> difference to context properties changing values?  After all, the
> principal purpose of \override is also to change the value, and
> \once\override very obviously changes behavior over time while
> interpreting music.

Since \override works by modifying special context properties, you can
actually use \set for setting grob properties. However, \override does
some extra useful work: for a start, it appends new overrides to a list
of overrides for a grob so that they can be easily reverted (\set just
clobbers the existing variable). Also, \override supports nested
properties (useful for things like 'bound-details). The type-checking
mechanisms are also different for \override and \set.

The implementation of \override is in context-property.cc, if you want
to look at it.

Cheers,
Joe






reply via email to

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