lilypond-devel
[Top][All Lists]
Advanced

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

Proposal: get rid of ly:export


From: David Kastrup
Subject: Proposal: get rid of ly:export
Date: Sun, 06 Nov 2011 10:43:33 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux)

Hi,

I've been annoyed in the past by the presence of ly:export since it
creates timing problems in the parser and lexer.  I propose completely
removing it.  As a replacement in the rare situations where it might be
applicable, I propose moving the $ syntax, now only used inside of #{
... #}, to Lilypond in general, in order to indicate auto-export at the
direct lexical level where it makes sense.

So that #{ ... #} would still be able to access music function variables
inside, it would inherit the lexical environment of its encompassing
definition.

This would imply that
#{ ... #$argument ... #}
would _cease_ working.  Instead you would have to write
#{ ... #argument ... #} in order to get a Scheme argument.  But at least
#{ ... #$defaultpaper ... #} would work the same in #{ ... #} as outside.

If ly:export is removed, we can split the work of
#( ... )
into two phases: at the lexical stage, the expression is read.  While
parsing, it is evaluated.  In that manner, we get rid of synchronization
problems.

In contrast, $ would read and evaluate in one piece.  As one benefit, we
would get rid of errormessages involving \lilytmpvarxxxx
pseudovariables.

This change would definitely cause problems to existing code.  Automatic
conversion seems only semi-feasible.

But it would give $ straightforward semantics everywhere (it would carry
a meaning always in Lilypond, never in Scheme).  And removing ly:export,
which requires messing up the logical order and timing of
lexing/parsing, would be a definite improvement, while still providing
its functionality in a non-obscure way.

-- 
David Kastrup




reply via email to

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