lilypond-devel
[Top][All Lists]
Advanced

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

Re: session macros


From: David Kastrup
Subject: Re: session macros
Date: Wed, 29 Jan 2020 00:22:12 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Han-Wen Nienhuys <address@hidden> writes:

> On Mon, Jan 27, 2020 at 11:33 AM David Kastrup <address@hidden> wrote:
>> >
>> > When calling the macro twice, we'll define add-session-variable twice,
>> > which seems fishy.
>>
>> I think you got confused here.  A macro is just an ordinary function on
>> its inside, it only differs in its calling conventions during
>> evaluation: instead of evaluating its arguments and calling the function
>> body like with ordinary functions, it is called with unevaluated
>> arguments and the result is then evaluated in its expression.
>>
>> add-session-variable is a local function defined inside of
>> define-session.  The effect is that it is not callable externally, and
>> not modifiable externally.  It is just putting stuff near to where it is
>> being used (it is used as a function in the expansion of the macro).
>>
>> define-session is a macro since its use parallels the use of define ,
>> and the first argument of define is the symbol to be defined which must
>> not be evaluated before define-session is being called.
>
> Thanks, I got it now.  I sent a mail to the guile-devel list to
> inquire what is going on.

Got any comments about macros being sooo yesterday compared to syntax
forms?  Syntax forms actually don't work in LilyPond: there was an
incompatibility because the 1.8 implementation will balk if some symbol
used in syntax forms already has a definition, and we have that.  I
forgot the exact symbol at fault.  I think it was some music function
name.

-- 
David Kastrup



reply via email to

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