[Top][All Lists]

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

Re: Enhancement to the syntax system?

From: Stefan Israelsson Tampe
Subject: Re: Enhancement to the syntax system?
Date: Mon, 2 Jul 2012 22:43:10 +0200

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 :-(


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)))>


reply via email to

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