Re: bug in psyntax?

[email protected]
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
On Fri, May 02, 2003 at 06:56:45PM +0100, Matthias Radestock wrote:
> (let ((x 1))
>   (let-syntax ([foo (syntax-rules () ((_) 2))])
>     (define x (foo))
>     3)
>   x)
> 
> => 2
> 
> (sc-expand '(let ((x 1))
>               (let-syntax ([foo (syntax-rules () ((_) 2))])
>                 (define x (foo))
>                 3)
>               x))
> 
> =>
> 
> ((lambda (|x_GAX0qWu6h|)
>    (letrec ((|x_GAFKfbx6h| '2))
>      (begin '3 |x_GAFKfbx6h|)))
>  '1)
> 
> It appears that let-syntax is not creating a local scope, letting the 
> binding for x escape into the surrounding scope.
> 
> Here is what R5RS has to say:
> 
> [section 5.2.2]
> Definitions may occur at the beginning of a <body> (that is, the body of 
> a lambda, let, let*, letrec, let-syntax, or letrec-syntax expression or 
> that of a definition of an appropriate form). [...]
> The variable defined by an internal definition is local to the <body>.
> 
> 
> To me this pretty unambiguously requires the above example to return 1, 
> not 2.
> 
> Have I missed something, or is this a bug in psyntax?

Looks like a bug to me, forwarded to Dybvig.

	Scott
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+sritr9IW4v3mHtQRAgV8AJ9krPUixoTmy1L/Qqh4UOpoS1FqtwCeLfRa
TCKp8GimUyzMuMXlCxZx7tY=
=BMf3
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.