[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Weird intermediate context creation
From: |
David Kastrup |
Subject: |
Re: Weird intermediate context creation |
Date: |
Mon, 06 Jan 2020 16:57:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Dan Eble <address@hidden> writes:
> I find it strange that this code in input/regression/bend-bound.ly
> ends up on two staves rather than one:
>
> music = \repeat unfold 16 { c''4\bendAfter #-4 }
> sixteens = \repeat unfold 64 { c'16 }
>
> \new Score {
> << \music \sixteens >>
> }
>
> I have a pretty good idea of why it is happening, and I am currently
> testing a change that affects 4 layout regtests including this one.
Why wouldn't it end up on two staves? << >> does not start new
contexts, it just groups them.
\new Score {
<< { c'4 d' e' f' } { c' d' e' f' } >>
}
will also produce two staves.
> The question is whether changing it is the right thing to do.
I have no idea what you want to change it to without breaking stuff like
\new StaffGroup << ... >>
> On the one hand,
>
> the current result is strange
Can you explain why you feel that?
> the NR is not clear as to whether the current result is expected; I
> lean toward reading it as unexpected
> the NR advises against relying on implicit context creation anyway
Implicit context creation is not going away. Things like Global and
Score context are created implicitly all the time.
> LilyPond will create lower-level contexts automatically if a music
> expression is encountered before a suitable context exists, but this
> is usually successful only for simple scores or music fragments like
> the ones in the documentation.
>
> The NR defines "bottom-level contexts" to include Voice and to exclude
> Staff, but leaves the reader to draw his own conclusion of what
> "lower-level contexts" are. I guess it means any required contexts
> that don't yet exist.
Bottom is any context without \defaultchild . Bottom is needed for most
events, but sets/overrides/applycontexts tend to be delivered to
somewhere in the context hierarchy.
> I'm not sure from this whether to expect \music and \sixteens to end
> up in separate Voice contexts. My intuition is that after a Voice
> context is created for \music, "a suitable context exists" for
> \sixteens.
The items in << >> do not invade one another automatically. You can
wrote \context Voice ... to pick up explicitly (and that's basically
what overrides/sets do) but other than that, there is no automatism. If
I write
<< \new Staff { c' } \new Voice { d' } >>
should the d' insinuate itself into the same staff as the c' ?
> On the other hand, changing this would change how existing scores that
> rely on automatic context creation are engraved. Is a change
> justified either on the grounds that the current behavior is a bug or
> that the NR gives fair warning not to rely on this feature?
I have no idea what behavior you propose instead.
--
David Kastrup