guile-devel
[Top][All Lists]
Advanced

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

RE: Lexically bound macro, with lexically bound transformer


From: Maxime Devos
Subject: RE: Lexically bound macro, with lexically bound transformer
Date: Fri, 26 Jul 2024 09:56:57 +0200

 

 

Sent from Mail for Windows

 

From: spacecadet
Sent: Wednesday, 24 July 2024 19:11
To: Taylan Kammer; guile-devel@gnu.org
Subject: Re: Lexically bound macro, with lexically bound transformer

 

> I think the guile-user list might be more appropriate.

 

Noted

 

>    (let-syntax ((outer (lambda (x) #'(+ 1 2))))

>      (let-syntax ((inner (lambda (x) (outer x))))

>        (inner)))

 

That works, but I guess this isn't possible then

 

(lambda* (#:key outer)

   (let-syntax ((inner outer))

     (inner ...)))

 

Since that would require evaluating run-time code at compile-time

 

>Is there a way to write a macro that's expanded at run-time?

 

With (local-eval #'(insert _expression_ to be done at run-time) (the-environment)), yes.

Caveat (from manual):

 

>Note that the current implementation of (the-environment) only captures “normal” lexical bindings, and pattern variables bound by syntax-case. It does not currently capture local syntax transformers bound by let-syntaxletrec-syntax or non-top-level define-syntax forms. Any attempt to reference such captured syntactic keywords via local-eval or local-compile produces an error.

 

The question is: why would you do that?

 

Best regards,

Maxime  Devos


reply via email to

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