lilypond-devel
[Top][All Lists]
Advanced

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

Re: Shortcut for \repeat unfold


From: Lukas-Fabian Moser
Subject: Re: Shortcut for \repeat unfold
Date: Sat, 25 Sep 2021 18:06:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0

Hi Jean,
I think it's a trap to see \repeat unfold as syntactic
sugar for repeating a sequence of characters n times
in the input. For instance,

\relative { \repeat unfold 4 c'1 }

is not the same as

\relative { c'1 c'1 c'1 c'1 }

Yes, of course. But I'd be very surprised if a large percentage of relative mode users would really expect "f4., g8 an then four times c,8" really to produce \relative { c, c, c, c, }. (Maybe those with a background in computer science would :-).)

So, when I talked about "syntactic sugar" I didn't mean the literal character-copy-and-paste sense.

Keyboards may be an important factor. Part of my
dislike for \* comes from the fact that on French
keyboards, the backslash is farther to the left,
on the same key as 8, making it less convenient
than what you describe.

They are not the only factor though. Let's see how
it looks visually:

{ c'1 \repeat 5 dis'8-_ c'1 }

{ c'1 \x 5 dis'8-_ c'1 }

{ c'1 \* 8 dis'8-_ c'1 }

{ c'1 dis'8-_**8 c'1 }

With \x or \*, I find it harder to discern the structure.
They are so small that they seem sprinkled over the input
without grouping other elements -- the third one in
particular looks like \* is some shortcut and 8 is
a duration repeating the previous pitch as in { c'1 8 }.

I think you're making it harder to read than necessary: Why the space after \* / \x ?

I like Werner's suggestion with ** better already.
What worries me a bit is the difference with the
existing use of *, which might be confusing. R1*5
will be (most of the time) equivalent to R1**5,
whereas c'1*5 will not be the same as c'1**5.
Something like c'1\p**5 will be valid, contrary to
c'1\p*5; c'1*4/5 will work but not c'1**4/5; …

I have to think about it a bit more.
My gut feeling is that postfix ** might be dangerous/difficult to implement robustly. But feel free to ignore this uneducated guess. :-)
I wouldn't push it so far -- it's easy enough to write
a music function for the repeat style you use most
often, just like you can shorten a lot of things
with variables and music functions, even more
conveniently now that we have \etc (let's hope the
latter would start working with \repeat someday).

By now, I know a handful of "normal" musicians among my friends who use LilyPond for their occasional engraving tasks. From what they show me when they have questions, I think there is still a significant number of users that stay in the mode of "never defining anything new except music variables" (and are still able to produce impressive scores). Of course, the advent of \etc has made it extremely easy to create simple music functions without even realising it; but I still think a sentence like "it's easy enough to write a music function" makes a possible feature practically invisible/unattainable for a large percentage of users: The idea of defining parameterised short-hands is not familiar to many people without a maths/computer science background.

Lukas




reply via email to

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