bug-lilypond
[Top][All Lists]
Advanced

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

Re: Change_iterator refuses to move a NullVoice into a Staff


From: David Kastrup
Subject: Re: Change_iterator refuses to move a NullVoice into a Staff
Date: Wed, 05 Apr 2017 11:41:17 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

David Kastrup <address@hidden> writes:

> Dan Eble <address@hidden> writes:
>
>> %{
>> NullVoice is unlike a Voice in this respect: trying to move it to a
>> different Staff with \change fails with this warning:
>>
>>     Change_iterator::process (): NullVoice = `soprano': 
>>     cannot change `Staff' to `S': not changing to same context type: Staff
>>
>> Apart from the warning, this is inconvenient.  The NullVoice remaining
>> in the original staff keeps the original staff alive, demanding manual
>> work to make it disappear.
>>
>> The NullVoice context definition contains both of the following:
>>
>>   \alias "Staff"
>>   \alias "Voice"
>>
>> My knowledge of contexts is not extensive, but I suggest that the test
>> that \change applies is too simple.
>
> The test is
>
>   else if (it.get_outlet ()->is_alias (to_type))
>     {
>       // No enclosing context was found because the iterator's immediate
>       // context is the kind that was sought.
>       /* We could change the current translator's id, but that would make
>          errors hard to catch.
>
>          last->translator_id_string () = get_change
>          ()->change_to_id_string (); */
>       result = _f ("not changing to same context type: %s", ly_symbol2string 
> (to_type).c_str ());
>     }
>
> and that's indeed crapola.  What the test should do is check whether the
> current context type would be accepted into the hierarchy of the
> proposed parent.

Well, that's a bit too simplistic because there is no "current context
type".

For something like

\change StaffGroup = "what"

the change iterator looks at the current context hierarchy upwards until
it finds a "StaffGroup" as a parent.  The layer below that is the
context to move, and if it is significantly similar in specification to
the context that should be/become its parent, it might become hard to
move back and forth.

So it's likely a bit of work/thought to make sure one does not create
context trapdoors from which it is hard to escape.  Hovercraft parent
contexts.

-- 
David Kastrup



reply via email to

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