lilypond-user
[Top][All Lists]
Advanced

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

Re: 5.6.1 Substitution function syntax


From: David Kastrup
Subject: Re: 5.6.1 Substitution function syntax
Date: Wed, 11 Aug 2021 20:24:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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.

-- 
David Kastrup



reply via email to

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