On Mon, Jul 2, 2012 at 9:28 PM, Ludovic Courtès
<address@hidden> wrote:
Hi Stefan,
Stefan Israelsson Tampe <address@hidden> skribis:
> Hygiene is harder to maintain. e.g. I kept on hitting this kind of code
> snippets
>
> #'(let ((x v))
> #,(f rest #'x))
>
> The problem with this code is hygiene, I need to make a gensym and use
> with-syntax to bound x to that gensym in order to be safe
> at the macro expansion.
What do you mean? Here ‘x’ leads to a newly introduced binding.
Likewise, the code below doesn’t introduce bindings non-hygienic
bindings, and is non-ambiguous:
(macroexpand '(let-syntax ((f (lambda (s)
(syntax-case s ()
((_ x y)
#`(let ((p x))
(+ p #,(identity #'y))))))))
(f 1 2)))
=> #<tree-il (let (p) (p-28239) ((const 1)) (apply (toplevel +) (lexical p p-28239) (const 2)))>
Thanks,
Ludo’.