[Top][All Lists]

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

Re: bookparts

From: David Kastrup
Subject: Re: bookparts
Date: Tue, 06 Mar 2018 13:12:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Jan-Peter Voigt <address@hidden> writes:

> Hi all,
> in this mail the thing with defining variables inside of curly
> brackets popped up the first time in this thread - so I hook here. (If
> it was mentioned in the former mails it doesn't matter ;-) )
> IISC a major change to the codebase would be needed to allow something
> like this: \bookpart { music = { c''4 } { \music } }
> but there are a lot users who would like to use it this way.
> I don't want to talk about scopes and coding style, but want to show
> how I deal with it:
> Using void-functions is a great thing because the can be called
> anywhere. So if you want to define something inside a file that is to
> be included inside curly brackets you can use a function like this:
> --------------------------------------
> \version "2.19.80"
> def = #(define-void-function (sym val)(symbol? scheme?)
>          (ly:parser-define! sym val))
> \bookpart {
>   \def music { c''4 } % this might be part of an included file
>   { \music }
> }

It would be utterly trivial to make assignments work like that void
function in the parser.

It still would not introduce scoping, so people would be surprised that
assignments made in one book overrode assignments in an earlier book or
at top level.

People would expect to set the same named variables in different books
to different values and it would not work.

A generic function like "def" is about as useful as a generic opener for
child-proof bottle caps: the only person needing it is one you don't
want to have it.

Now books and bookparts actually have a \header with associated scopes.
Anything wrong with doing assignments in there?

David Kastrup

reply via email to

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