Am 21.11.22 um 23:28 schrieb Jean Abou Samra:
One would add a new keyword in the parser akin to \include
(\import? \load?).
How about \require?
... module code ...
\endModule % or whatever name
... example ...
where \endModule would act as a "trap" interrupting the parsing,
but only if the file is included. If the file is compiled as
main, it would continue parsing, and after \endModule you could
put some examples and tests for the snippet / module functionality.
That is how module documentation in TeX works (as you are probably
aware). I don’t think many users would look into that, esp. since
LilyPond’s documentation is more concise and centralized.
Otherwise I’ll leave this discussion to you, since I never need the more
sophisticated features of LilyPond for my folk songs and odd other piece.
Thank you for your work!
Hraban