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

Look!

racket:
(define-for-syntax (f x) #`(let ((x 1)) #,x))
> (define-syntax (g x) (syntax-case x ()((_ y) #`(let ((x y)) #,(f #'x))))
)
> (g 4)
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 <l...@gnu.org> wrote:

> Hi!
>
> Stefan Israelsson Tampe <stefan.ita...@gmail.com> 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
> ‘syntax-rules’.
>
> > I do think
> > that the best solution is to somehow extend the syntax expander to mimic
> my
> > sugested
> > #. and #.@. 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.
>
> Thanks,
> Ludo’.
>

Reply via email to