lilypond-user
[Top][All Lists]
Advanced

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

Understanding ly:parser-include-string


From: Urs Liska
Subject: Understanding ly:parser-include-string
Date: Wed, 27 Jan 2016 17:24:50 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

Hi,

I'm running into an issue with including files using
ly:parser-include-string.

The underlying task is that I want to conditionally include files, so I
have the pseudo-code:

#(if (some-condition)
     (ly:parser-include-string "\\include \"some-file.ily\""))

This works pretty well for single items. It is also possible to insert
multiple \include-s in the string, and all files are loaded. However,
when a file defines anything, subsequently included files don't have
access to it. It seems the whole conditional expression has to be
evaluated until the new definitions are available.

And if I only include this single some-file.ily this can again include
multiple files (with regular LilyPond syntax). And again, files included
that way don't have access to definitions (variables, functions) that
are in files included earlier.

The same is true for modules.
If this some-file.ily uses a module-1 and later a module-2 module-2
doesn't have access to items defined in module-1.

In a way I need something like the (let* construct but for
ly:parser-include-string.

Can someone confirm that my observation is correct (and intentional)?
And is there a solution for my original problem: conditionally including
files with multiple secondary includes?

TIA
Urs
   



reply via email to

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