lilypond-user
[Top][All Lists]
Advanced

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

Re: Mutable and immutable


From: PMA
Subject: Re: Mutable and immutable
Date: Tue, 18 Aug 2015 21:57:11 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20101227 Iceape/2.0.11

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



reply via email to

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