[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Inherency of object properties
From: |
Mats Bengtsson |
Subject: |
Inherency of object properties |
Date: |
Fri, 23 Jan 2004 12:38:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031007 |
There's one intricate feature of LilyPond that occasionally
causes trouble (I've seen questions related to it once or twice
a month) and that I find difficult to explain.
For example, why does the first setting of style work but not
the second one in the following example:
\score{\notes\relative c'{
\property Staff.NoteHead \override #'style = #'slash
c d e f
%\once \property Voice.NoteHead \override #'transparent = ##t
c d e f
\property Staff.NoteHead \override #'style = #'cross
c d e f
}}
I can understand why since I understand how it's implemented
(all properties of an object form an association list and
a context only gets a copy of its own if some property of
the object is set within that context, otherwise the value
is inherited from contexts higher in the hierarchy). I can
even see some good reasons why it's implemented this way.
However, it's much harder to explain it to a non-programmer.
Also, this is an example of a hidden (and un-documented)
side-effect that's considered no-no in most methods for
structured programming.
Finally, it's even more impossible to circumvent for a user
that uses predefined identifiers such as \hideNotes.
I consider this "feature" a bug.
It's great to have the possibility to specify the granularity
of a property setting, letting it apply to the full score or just
a single thread, but then this should work in the full piece, not
just at the beginning of the piece.
/Mats
--
=============================================
Mats Bengtsson
Signal Processing
Signals, Sensors and Systems
Royal Institute of Technology
SE-100 44 STOCKHOLM
Sweden
Phone: (+46) 8 790 8463
Fax: (+46) 8 790 7260
Email: address@hidden
WWW: http://www.s3.kth.se/~mabe
=============================================
- Inherency of object properties,
Mats Bengtsson <=