lilypond-devel
[Top][All Lists]
Advanced

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

Re: Repeat alternative count


From: David Kastrup
Subject: Re: Repeat alternative count
Date: Sun, 30 Aug 2020 20:55:50 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Dan Eble <dan@faithful.be> writes:

> After further thought, I believe we can do this, but using \volta
> where you have \alternative.  These are my current thoughts (some
> informed by experiment).
>
> \volta i,j,k can be used anywhere and is semantically similar to tags.
> During unfolding, music is kept which is either marked for the current
> volta or is unmarked.  An important difference from tags is that
> unfolding will avoid processing nested repeats before their time.
>
> If you write { \volta 6,12 {…} … \volta 12,13,5 {…} }, LilyPond will
> give you what you seem to be asking for, in repeat layout, unfolded
> layout, and in midi, and not try to make more sense of it than is
> necessary.
>
> \alternative remains (but at some point is renamed \alternatives) for
> these reasons at least:
>
> a. backward compatibility: the legacy syntax produces the same data
> structures as if \volta had been used
>
> b. it provides a scope in which LilyPond can derive implied volta
> numbers as previously discussed in this thread
>
> c. like (b), it might be helpful for producing brackets (but I haven't
> thought much about it yet)

The reason I want to lose it is that most constructs of the form

\prefix ... { ... }

do not require further lookahead to resolve.  That's important in
several respect, such like writing

music = \prefix ... { ... }

\music

\alternative is one ugly wart in that respect.  \addlyrics is another.
Either cause a fair share of headaches whenever there is a change in the
parser.

Also, \alternative is basically the only construct I know that has
{ sequence of music expressions } mean something different from, well, a
sequential music expression.  There have been several cases of people
getting tripped up when forgetting to add inner braces.

Also when the included expressions become longer, the readability for
humans goes down the drain since the individual alternatives are not
separated by anything other than } { or similar.

\volta (?) would be able to take an _optional_ number list if we are
reasonably sure that this is all we need.

Usually prettier alternatives can come with a backward compatibility
hook (though their lifetime tends to be semi-eternal).  But in this case
the ugliness does not just extend to the input, but also to the input
processing.

-- 
David Kastrup



reply via email to

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