dak wrote: > > AFAICT it's never valid to explicitly create a score context (and > > the notation manual says so); if that's not true, then this isn't > > safe. > > Where does the manual say that? It's not true.
I was imagining it. :( Learning Manual 3.3.2 says “\new Score should not be used” (but it also says “The Score context is usually left to be created automatically”), and Notation Manual 5.1.1 says "A Score context is instantiated implicitly when a \score {…} or \layout {…} block is processed", but it never actually says it *can't* be explicitly created. [on doing start_translation_timestep for new contexts] > Better late than never... The problem is then to avoid calling > start_translation_timestep twice under any circumstances. It would only be called again if a context was created during start_translation_timestep. I don't think that happens now, but translators do a lot in start_translation_timestep, so it might accidentally happen someday. Doing start_translation_timestep in mid-timestep is unclean, though, and may confuse translators that expect it to be called at the beginning. It passes the tests, but I wouldn't be surprised if it introduces bugs. I don't think it's an improvement. Iteration has an awful lot of undocumented invariants about what's called when and who listens to what. It would be nice to detect and warn about violations. Some possibilities to make iteration more maintainable: * Call start/stop_translation_timestep directly from run_iterator_on_me, not through translators. Remove the Prepare and OneTimeStep events. * Create contexts in advance by calling create_children before each timestep. * Warn when contexts are created in mid-timestep. * Figure out other context invariants and write them down. _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel