lilypond-user
[Top][All Lists]
Advanced

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

Re: \pushToTag and \appendToTag examples


From: David Kastrup
Subject: Re: \pushToTag and \appendToTag examples
Date: Thu, 29 Apr 2021 16:16:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Gianmaria Lari <gianmarialari@gmail.com> writes:

> Following David Kastrup's suggestion, I wrote some hopefully simple
> examples for \pushToTag and \appendToTag.
>
> I paid the maximum attention to make this code simple and clear but I'm
> sure it contains millions of errors etc. etc.
> It's just a starting point. I hope it can be useful.
>
> Nota bene: I didn't yet add any examples that take advantage of David new
> possibilities:

Ah, but that was sort of the point.

The challenge with both documentation and regtests is that the examples
are concise and it is easy to see what happens.  For regtests it is
important that they are supposed to provide visual verification without
necessarily looking at the source code.  That means that the description
has to state what to expect, or there must be some differently written
comparison showing what to expect.

For documentation, one wants to show the type of problem that a
construct is supposed to solve.  The complexity will usually be such
that using some functionality like that is overkill but it will still be
obvious what the utility is when things do get more complicated.

> P.S. I would have liked to add a screenshot of the generated output
> immediately after each piece of code.
> This would make this much more interesting, easy to follow and discuss. But
> I remember that on this mailing list pictures have to be attached and not
> put inside the mail.

I use inline MIME attachments and there are few complaints, but some
mail clients do some sort of HTML contraption not working in text mode
and those will not make it through a lot of mail clients or mailing list
summarisers.

> Let me know if the "mailing list good practices" have changed.
>
> %%%%%%%%%%%%%%%%%%%%%%%
> \markup {"Simple \appendToTag with {}"}
> \version "2.23.2"
> music = {c'1 \tag #'here {} c''1}
> {\music}
> {\appendToTag #'here g'1 \music}
> {\pushToTag   #'here g'1 \music}

Tagging an empty {} and pushing a single element means that there is no
visible difference between \appendToTag and \pushToTag .

> {\appendToTag #'here {e'4 f' g' a'} \music}
> {\pushToTag   #'here {e'4 f' g' a'} \music}

Same here, and the example is more complex than necessary for bringing
the point across.

> \markup {"Nested \appendToTag with {}"}
> \version "2.23.2"
> music = {c'1 \tag #'here {} c''1}
> {\music}
> {\appendToTag #'here d'4 \appendToTag #'here e'4 \appendToTag #'here f'4
> \appendToTag #'here g' \music}
> {\pushToTag   #'here d'4 \pushToTag   #'here e'4 \pushToTag   #'here f'4
> \pushToTag   #'here g' \music}

This at least shows a difference between \appendToTag and \pushToTag

> \markup {"\appendToTag with {} and multiple different tag"}
> \version "2.23.2"
> music = {c'4 d' e' f' \tag #'firstLocation {}
>          g' a' b' c'' \tag #'secondLocation {} }
> {\music}
> {\appendToTag #'secondLocation {d''2 e''} \appendToTag #'firstLocation {g'4
> f' g' f'} \music}
>
> \markup {"\appendToTag with {} and multiple equal tag"}
> \version "2.23.2"
> music = {c'4 d' e' f' \tag #'firstLocation {}
>          g' a' b' c'' \tag #'firstLocation {}
>          b' a' g' f'  \tag #'firstLocation {} }
> {\music}
> {\appendToTag #'firstLocation {g'2 r} \music}

This just makes the example more complicated without demonstrating any
additional functionality or use.  Makes it hard to interpret either
manual entry or regtest.
>
> % I don't see any good reason to use the following.
> % It mix different things making everything a bit more complex
> % to understand withouth any advantage (imho).
> % That's why I'm not sure it makes sense to show it.
> \markup {"\appendToTag with {some music}"}
> \version "2.23.2"
> music = {c'1 \tag #'here {d'2 e'} c''1}
> {\music}
> {\pushToTag #'here {f'4 g' a' b'} \music}
> {\appendToTag #'here {f'4 g' a' b'} \music}

This at least shows a difference between \pushToTag and \appendToTag .

> % {\appendToTag #'here <e' g' b'>1 \music} % Doesn't work. Adding a chord
> to a chord is not defined/allowed

Should it, though?  Should there be something else for achieving that
effect?  If so, what interface?

> % {\appendToTag #'here {e'1 g'1 b'1} \music} % Doesn't work. Adding a
> compound music expression to a  chord not defined/allowed

I have no problem with _that_ not being allowed.

> \markup {"\appendToTag with <c' e'>"}
> \version "2.23.2"
> music = {c'1 \tag #'here <c' e'>1 c''1}
> {\music}
> {\appendToTag #'here g'1 \appendToTag #'here b'1 \music}
> % {\appendToTag #'here g'4 \music} % Doesn't work. Adding a 4 duration note
> to a 1 duration chord is not defined/allowed

In my book, there is no big point served in trying to prohibit it, and
there are other constructs that may introduce it.  You can still write
<<c'4 e'1>> with the same problem, namely that this kind of single-stem
(because of being issued in a single voice context) "string chord"
(often encountered in solo music for string instruments) is not (yet?)
properly supported by LilyPond.

So I would not mention it, not block it, not test for it.  The problem
is that trying to enforce some duration makes no sense when adding to <>
anyway, so you'd need to distinguish the 0-case, and it's not clear
which duration should prevail and whether that would be different
between \pushToTag and \appendToTag .

Do you see why I hate writing documentation and regtests?

-- 
David Kastrup



reply via email to

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