|
From: | Kees van den Doel |
Subject: | Fwd: 5.6.1 Substitution function syntax |
Date: | Wed, 11 Aug 2021 12:04:55 -0700 |
Le 11/08/2021 à 20:24, David Kastrup a écrit :
> Kees van den Doel <kvdoel@gmail.com> writes:
>
>> Referring to
>> https://lilypond.org/doc/v2.22/Documentation/notation/substitution-function-syntax
>>
>> I don't understand this sentence explanating "...music...":
>>
>>> normal LilyPond input, using $ (in places where only LilyPond constructs
>> are allowed) or # (to use it as a Scheme value or music function argument
>> or music inside of music >lists) to reference arguments (eg. ‘#arg1’).
>>
>> The next section in the docs with examples has no example of use of '$'.
>> When should I use $?
> In a nutshell, when # does not work. The syntax of an _expression_ is
> decided before even looking at the value of the _expression_ after # . So
> # in a certain place will only accept a certain type.
>
> For example, inside of { }, an _expression_ started with # has to be a
> music _expression_, while $ allows expressions of type duration, pitch,
> post-event and probably others, integrating/converting them in the
> expected manner to music.
>
> $ first looks at the _expression_'s type and then decides about its
> syntactic properties. Since the LilyPond _expression_ parser works with
> lookahead for disambiguating expressions, that means that such
> expressions may be evaluated earlier than expected by the user.
>
> So generally # causes fewer syntactic surprises but is less flexible.
> Also it does not copy music expressions but takes them as-is. That can
> cause a difference in some cases.
Some examples are found in
https://extending-lilypond.readthedocs.io/en/latest/lily-and-scheme.html#hash-vs-dollar
[Prev in Thread] | Current Thread | [Next in Thread] |