lilypond-devel
[Top][All Lists]
Advanced

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

Re: bar-line interface part 2/2: New bar line definition standard (issue


From: Marc Hohl
Subject: Re: bar-line interface part 2/2: New bar line definition standard (issue 6498052)
Date: Sun, 30 Sep 2012 21:44:47 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120912 Thunderbird/15.0.1

Am 30.09.2012 11:02, schrieb address@hidden:
[...]
First, the define-public is asking for trouble. You are exposing an
internal Scheme data structure to users and make it overwritable by the
user. If the user follows this invitation, the effects will bleed over
from session to session. Never do that.
Ok.

Consider _everything_ written in a .scm file as readonly conceptually.
For an alist, you might want to define a _function_ returning the
initial list, and the accessors should not be modifying it destructively
(adding to the front of an alist does not change the original alist).

Then you assign this initial value to a session variable in something
included in init.ly, like
#(define bar-glyph-alist (initial-bar-glyph-alist))
Ok.

Your functions working with bar-glyph-alist have to take the version of
bar-glyph-alist defined in the parser module. That means that when you
call them from .ly files, you'll likely need to pass bar-glyph-alist
from the .ly file into your Scheme function. Or get them via
ly:parser-lookup via the parser variable.
I am not sure whether I understand this completely, but I'll give
it a try.

If you put a new bar line definition into a.ly, and when calling
lilypond a.ly b.ly
it is available in b.ly, then you have done something wrong.
I did this and can confirm that a bar line defined in a.ly *is*
available in b.ly.

So I have to replace all three public alists in bar-line.scm the way you
described it above.

[OT: it seems that I have a strong attraction to problems that look
not very difficult at first glance and turn out to involve *a lot of*
changes and obstacles until they get solved.
On the other hand, this is a *perfect* way to learn about the internals
of lilypond – in such situations where everything breaks, I remember
Jan working on GUB during Waltrop and his statement when the
compilation broke again: "That's nice." I admire such a serenity and
try to adopt it in situations where I am about to throw the computer
out of the window ;-) I am not in this state yet, but I am working on it...]

Regards,

Marc

http://codereview.appspot.com/6498052/





reply via email to

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