Lutz wrote:Later yoday I will release development version 8.8.6 which has a new 'letex': a combination of 'let' and 'expand'. This together with define-macro will give you full macro power and using the default function mechanism macros are hygienic, and you have finer control with the possibility to do macro-expansion with 'letex' independent from a function definition.
I don't know know
exactly what you mean here; however, be forewarned that, even with the use of 'letex', there is still the possibility that one's macro could suffer from variable capture. For instance:
Code: Select all
(define-macro (testie simble)
(letex (x 42 y simble)
(list x y)))
> (set 'x 1)
1
> (testie 1)
(42 1)
> (testie x)
(42 42)
However, in the following instance, if we follow the method of Dmi, 'x' will not get captured.
Code: Select all
(context 'testie2)
(define-macro (testie2:testie2 simble)
(letex (x 42 y simble)
(list x y)))
(context MAIN)
> (set 'x 1)
1
> (testie2 x)
(42 1)
> (testie2 1)
(42 1)
In the manual, 'letex' does not claim "hygenicity", so we are OK. I just didn't want anyone to have the wrong idea about 'letex'. (Hint: I did.) --Rick
(λx. x x) (λx. x x)