Robert Kubosz <kubosz.rob...@gmail.com> writes: > I want to make a copy of a variable defined in a separate file, but run in > the same current-module. > The copy I make is a copy-by-reference, and in result any modifications I > apply to the copy also appear in the original. > How do I make a copy-by-value in a current-module? > > More detailed example is attached to this email. > > Thanks in advance! > Robert
Well, one thing to note is that LilyPond's "contract" is that you only work with copies of music. That is why something like \trumpet-first actually delivers a _copy_ of trumpet-first rather than the original. Commands like \transpose then feel free to change their input as it is either a mere copy or does not exist elsewhere under a different name. So when you do Scheme programming, you need to work with copies. The easiest way, of course, is not to access variables directly but only write music functions processing their input. Since you can deliver this input in LilyPond mainly using \... it automatically is either a copy or an original expression not used elsewhere. The other way is to use ly:music-deep-copy and it's not like this isn't mentioned in the "LilyPond — Extending" guide of LilyPond. -- David Kastrup