guile-devel
[Top][All Lists]
Advanced

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

Re: Enhancement to the syntax system?


From: Ludovic Courtès
Subject: Re: Enhancement to the syntax system?
Date: Mon, 02 Jul 2012 21:28:29 +0200
User-agent: Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.1 (gnu/linux)

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’.




reply via email to

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