Re: Bug in \relative parsing?

Luca Fascione <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.devel
Message-ID <CAN3Q5Nh2qnW91TZ1ss+Bj5a5kNnB=hOK3n3sJE1FB=WxK6N2Ew@mail.gmail.com>
On second thought, I don't think it is all that obvious that my original
interpretation was wrong, David.
You said

On Fri, Aug 21, 2026 at 9:02 AM David Kastrup <[email protected]> wrote:

> your understanding is wrong.  \relative takes
> a _pitch_ argument as its start, not a note, so this is parsed as
>
> \relative a' { 4 } { c }
>

Although my understanding of the frontend's current behavior was wrong, I
believe my expectation was reasonable,
because this issue of mine stems from the grammar ambiguity introduced by
making the startpitch argument to \relative optional.

The ambiguity resolution in `\relative a'4` you're saying today goes to
`\relative a' { 4 }`, but I expected it would go to `\relative { a'4 }` ==
`\relative a' { a'4 }` instead, because this is what a human would expect
on a "rule of least surprise" basis: the author wrote down a full note
(what if the note was something more meaty like `a'4^3\5-.\fermata`, say),
why would it be broken apart into a pitch used for startpitch and then some
free standing durations/articulations and autoattached to previous context?

Separately, I find it surprising that if you write `\relative X4^3\5-.\fermata`
you can place anything that looks like a pitch where I wrote X and it has
no effect  on the score, whereas if one insists on the current eager
parsing, it would feel more useful if the behaviour of unattached
duration/articulations was as if the previous note were explicitly repeated
inside: `f \relative a' { 4 }` == `f \relative a' { f4 }`, meaning printing
the second f an octave higher, in this example.

Now, obviously I can't really come up with a strong case for these usages,
except maybe placing an absolute pitch in the middle of a relative
sequence: `\relative c''' { c d e f \relative { a,, } g a }` kinda
situation, which effectively places the one note in absolute mode, and then
picks up where it had left off. Doesn't seem like this comes up very often,
not in the kind of music I play, at least.

This seems like it would warrant a few words of explanation in the
documentation, I could find no information one way or the other about this
in the page that explains what `\relative` does

Cheers,
L


-- 
Luca Fascione
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.