On Thu, Jul 30, 2009 at 7:19 PM, Mark Polesky<markpole...@yahoo.com> wrote: > The problem with this approach is that if one uses "define" (or > preferably "set!" as Neil mentioned) to change the variable within a > music block, the new value persists beyond the closing curly-brace of > the music block. It will even persist into any subsequent score blocks, > which can lead to unexpected results. Even worse, the source of these > unexpected results may be difficult to track down, especially in large > projects with multiple score blocks. > > One reason that I found this particularly frustrating was the implicit > (and apparently incorrect?) belief that curly braces in LilyPond define > boundaries for a local scope (as in many programming languages). Please
Braces are overloaded in LilyPond. In some cases they define scopes (like \paper and \header), and in other cases, they just group syntactic constructs (\book, \score, sequential musics). The solution you propose sounds hairy to me. I think you probably want are looking for a real scoping construct inside music expressions. I don't think this is a very neat idea, because these scoping constructs will necessarily not nest correctly wrt { } and << >>. The confusion arises from your use of #(set! .. ), ie. direct interaction with the scheme interpreter. It is assumed that people who do this know what they are doing. Note that in 'native' lilypond syntax, this problem is nonexistent, since assignments may only occur at toplevel. -- Han-Wen Nienhuys - han...@xs4all.nl - http://www.xs4all.nl/~hanwen _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel