lilypond-user
[Top][All Lists]
Advanced

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

Re: for-each?


From: David Kastrup
Subject: Re: for-each?
Date: Mon, 03 Jul 2023 22:08:35 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

David Kastrup <dak@gnu.org> writes:

> Lukas-Fabian Moser <lfm@gmx.de> writes:
>
>> Or maybe even:
>>
>> \version "2.25.6"
>>
>> parts = {
>>   { c' }
>>   { d' }
>>   { e' }
>>   { f' }
>> }
>>
>> group = #
>> (define-music-function (parts) (ly:music?)
>>   #{
>>     \new StaffGroup
>>     $(make-music 'SimultaneousMusic parts)
>>   #})
>>
>> \group \parts
>>
>> ? But I'm surprised (a bit) that I need $ here - the \new commands
>> still puzzle me sometimes.
>
> Huh.  I would not have thought so either.  Maybe worth looking at.

Ugh, that's a can of worms.  #xxx will only accept a context-dependent
set of values and reject values not fitting the context.  But the
context includes whether or not, for example, we are in lyrics mode.
For that reason \new ... accepts only a rather limited set of
expressions, mostly delimited expressions where the mode-switching
happens at the delimiters.

So it's more the $... that is problematic, but $... always comes with a
warning tag with possibly untimely mode switching because of how parser
lookahead works.

So all in all, I'm queasy about touching anything here.  It's not like
you cannot just use one level of { } to get a context where #... will be
well-defined.

-- 
David Kastrup



reply via email to

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