Maybe this help to see what I'm after,
#'(let ((x v)) #.(f #'x))
<=>
(let-syntax ((g (lambda (stx) (syntax-case stx ((_ x) (f #'x)))))
#'(let ((x v)) (g x))
Now I would like to have a corresponding #.@ notation as well but can't find an analog
for that :-(
/Stefan
Hi Stefan,
Stefan Israelsson Tampe <stefan.itampe@gmail.com> skribis:
What do you mean? Here ‘x’ leads to a newly introduced binding.
> 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.
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’.