Forgot mailinglist, sorry.

---------- Forwarded message ---------
From: Kees van den Doel <kvd...@gmail.com>
Date: Wed, Aug 11, 2021 at 12:03 PM
Subject: Re: 5.6.1 Substitution function syntax
To: Jean Abou Samra <j...@abou-samra.fr>


Thanks Jean, David,

That clarifies it, subtle stuff!

Kees

On Wed, Aug 11, 2021 at 11:45 AM Jean Abou Samra <j...@abou-samra.fr> wrote:

>
>
> Le 11/08/2021 à 20:24, David Kastrup a écrit :
> > Kees van den Doel <kvd...@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
>

Reply via email to