[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: Tue, 10 Jul 2012 15:35:27 +0200

I did miss something when trying in racket, it's a psyntax bug!


(define-for-syntax (f x) #`(let ((x 1)) #,x))
> (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x))))
> (g 4)

In guile,
scheme@(guile-user)> (define (f x) #`(let ((x 1)) #,x))
scheme@(guile-user)> (define-syntax g (lambda (x) (syntax-case x () ((_ y) #`(let ((x y)) #,(f #'x))))))
scheme@(guile-user)> (g 4)
$1 = 1

I much prefer rackets version here. I will file a bug report and also try to understand what spec that racket is following!

On Tue, Jul 10, 2012 at 10:24 AM, Ludovic Courtès <address@hidden> wrote:

Stefan Israelsson Tampe <address@hidden> skribis:

> | It’s true that it’s annoying that the wrong binding is silently used.
> | Do you think it’s common enough to justify new syntax?
> Yes this highlights a comon problem when implementing racket match with #`.

Sure, but it’s not good-style.  ;-)  In general, ‘syntax-case’ is great,
but it’s low-level plumbing to be used with care, compared to

> I do think
> that the best solution is to somehow extend the syntax expander to mimic my
> sugested
> #. and address@hidden The simple solution is to rewrite according to
> #`(... #.((x y) (f #'x #'y)))
> ->
> #`(let-syntax ((g (lambda (x) (syntax-case x () ((_ x y) (f #'x #'y))))))
>       (... (g x y))

Unlike syntax-{quote,unquote,...}, #. has no non-syntax-prefixed
equivalent.  And what it does is non-trivial.  So I don’t feel
comfortable with this extension, FWIW.


> I also feel that the issue needs to be
> liffted up to the
> community of at least syntax-case user crowd before doing anything Ill try
> to spur
> some discussions on it and come back later!

Yes, this should be discussed on c.l.s or scheme-reports.


reply via email to

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