lilypond-user
[Top][All Lists]
Advanced

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

Mutable and immutable


From: Andrew Bernard
Subject: Mutable and immutable
Date: Wed, 19 Aug 2015 10:51:59 +1000
User-agent: Microsoft-MacOutlook/0.0.0.150807

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








reply via email to

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