Hello,
tl;dr: why no multiple layout inheritance?
I'm trying to build a layout inheritance system. I'd like, for example,
layoutC to inherit from both layoutA and layoutB:
\version "2.27.3"
layoutA = \layout {
\override NoteHead.color = "red"
}
layoutB = \layout {
\override Stem.thickness = 10
}
layoutC = \layout {
\layoutA
\layoutB % ERROR: bad expression type
\override Stem.length = 20
}
\score {
{ c'4 d' e' f' }
\layout { \layoutC }
}
Only one layout can be included, and it must be first.
I glanced at parser.yy (I'm no programmer). From what I understand, when
parsing a \layout { } block, LilyPond sets a flag at the start. Including
another layout (like \layoutA) is only allowed while this flag is set.
After the first item is processed, the flag is cleared - so a second layout
triggers "bad expression type".
Questions:
What is the rationale for allowing only one parent layout?
Could multiple includes be supported with "last setting wins" semantics?
Thank you,
*Pierre-Luc Gauthier*