Han-Wen Nienhuys <hanw...@gmail.com> writes:

> On Mon, Jan 27, 2020 at 11:33 AM David Kastrup <d...@gnu.org> 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