lilypond-user
[Top][All Lists]
Advanced

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

Re: bookparts


From: David Kastrup
Subject: Re: bookparts
Date: Mon, 05 Mar 2018 22:23:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Wols Lists <address@hidden> writes:

> On 05/03/18 17:55, Kieren MacMillan wrote:
>> Hi Knut,
>> 
>>> Because the definition of testing is invalid at that point of the main
>>> source file. If tempTest.ly would contain e.g. a score or a \paper block
>>> no error would occur.
>> 
>> No, it still throws an error because you can't define a variable
>> inside a \bookpart (which is what \include-ing it at that point
>> does).
>> 
> And as a programmer, I think "scope". You are defining the variable
> where you want to use it.

That's not what "scope" means.

> It's widely accepted that that is good practice, global variables lead
> to errors, mistakes and confusion. But here you are forced to declare
> your variables at the global level :-(

Bookparts at global level are collected into an implicit book.  If books
have a scope of their own, no "global" definitions would be visible in
explicit books since they would be separate from the scope in the
implicit book.

Everybody thinks that beating sense into the historical design of
LilyPond should be trivial and that he is entitled to have things
correspond to his handwaving.  So as a programmer, why not try making
stuff actually work as you think they should?  Scopes and closures
actually work seamlessly across #{ #} (as of 2.14 or 2.16).  Scheme has
the tools to do the work once you have your concepts consistent.

Unfortunately, there does not appear to be a concept readily consistent
with scoping the current book/bookpart design.  Because "scope" does not
mean "you are defining the variable where you want to use it".  A
consequence of well-defined scopes is that you can more often do it in
that manner without impacting other code.  But I haven't seen a good
"well-definition" with LilyPond.  I am pretty sure that people would
protest books not getting to see definitions made "outside" of them.  So
normal books would have to be nested in the implicit default book like
bookparts of the implicit book are.

-- 
David Kastrup



reply via email to

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