[racket-dev] Enhancement to the syntax system?

From: Marijn (hkBst at gentoo.org)
Date: Tue Jul 10 10:34:26 EDT 2012

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10-07-12 15:35, Stefan Israelsson Tampe wrote:
> I did miss something when trying in racket, it's a psyntax bug!

I'm glad you're finally looking harder at the Racket behavior.

> 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

This code produces the same error for me with Racket which I reported
earlier, but I seem to have been using a non-release version. So,
switching to 5.2.1, I can report that indeed the code

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

produces 4, which makes sense to me. However when I retry my earlier
example

#lang racket

(define-for-syntax (f stx) #`(let ((x 1)) #,stx))

(define-syntax (m stx)
  (syntax-case stx ()
    ((_) #`(let ((x 2)) #,(f #'x))) ))

(m)

it now produces 1 instead of the expected 2.

It seems to me that both these results cannot be correct
simultaneously, but I'll await the experts' opinion on that.

Marijn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk/8PXIACgkQp/VmCx0OL2zdfQCeOVJz/ECKExThGPJoqvRY3E41
gr0An0vSsuXK2B7xi0WT0LuzvVvhUbcy
=04xS
-----END PGP SIGNATURE-----

Posted on the dev mailing list.