Andrew Bernard wrote:
Greetings All,
Since immutable as an adjective applied to an object in most programming
languages, and in normal English usage means unchanging over time, or unable to
be changed, how is it that the value of immutable objects can then be changed
with \override and \revert? From the Technical Glossary:
An immutable object is one whose state cannot be modified after creation, in
contrast to a mutable object, which can be modified after creation.
In LilyPond, immutable or shared properties define the default style and
behavior of grobs. They are shared between many objects. In apparent
contradiction to the name, they can be changed using \override and \revert.
I fail to understand this entry. Surely the name must therefore be ‘shared’ or
‘default’’ or similar? How can such a contradiction persist, with no
explanation given?
In some Scheme code I am writing I am trying to change the line style of a
TextSpanner:
(ly:grob-set-property! grob 'style 'dotted-line)
But the value remains unchanged after the call, with no error. Is ‘style’ an
immutable property? Can it only be changed using \override, and not directly in
Scheme?
I cannot speak for others, but I find the distinction between mutable and
immutable in lilypond to be rather unrigorous and downright strange – and
therefore completely confusing. I am sure it is important in the architecture
of the application, but the terms are of no help to somebody learning the
language, unless there are expanded notes on what the essence of the meaning
is.
Andrew
FWIW, I think of \override and \revert as _extreme_ measures appropriate
and necessary for altering a Constant, as opposed to the routine measure
(mere re-assignment) sufficient to alter a Variable.
But then, I'm from a generation trained in Pascal.
- Pete
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user