lilypond-auto
[Top][All Lists]
Advanced

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

Re: [Lilypond-auto] Issue 3777 in lilypond: Code improvements to satb.ly


From: lilypond
Subject: Re: [Lilypond-auto] Issue 3777 in lilypond: Code improvements to satb.ly built-in template
Date: Thu, 09 Jan 2014 12:00:12 +0000


Comment #18 on issue 3777 by address@hidden: Code improvements to satb.ly built-in template
http://code.google.com/p/lilypond/issues/detail?id=3777

The difference between $x and #x is twofold: $x is analyzed in the lexer, given a particular token category based on its value, and then further interpreted. That means that things like
x = { c d e f }
$x
don't work since the parser requires lookahead of one token to decide whether this is going to turn into
x = { c d e f }
\addlyrics { Hi! }
and when $x is evaluated by the lexer, things go awry. #x just _reads_ x without looking at its value and tells the parser "this is going to end up as a Scheme expression". Then it does the assignment to x, and only afterwards gets to evaluate the value of the already read expression x. This works nicer, but it requires the _parser_ to interpret the value as desired.

Now for \layout, you almost always want a _copy_ of the layout rather than the original to play with. Since $x also copies while #x only interprets, supporting #x for layout may lead to bad usage easily. Not that this was an intentional decision.

The point is that the meaning of any #xxx expression is not wired into the Parser grammar: the grammar cannot distinguish any #x from any other. Instead, the code executed by #xxx has to go and analyze the set of values and take appropriate action that usually cannot (or cannot easily) result in different interpretations depending on the _type_ of expression as looking at the value is a _semantic_ action, and the ways of letting those feedback into the _syntactic_ analysis are limited and cumbersome.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings



reply via email to

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