[plt-scheme] eval & syntax-rules

From: Skeptic . (skeptic2000 at hotmail.com)
Date: Tue Apr 20 12:31:27 EDT 2010


Yeah that sounded "too good" to be true, as I was pretty sure to have read here that eval cannot have access at all to the enclosing bindings.
> Date: Tue, 20 Apr 2010 11:16:22 -0500
> Subject: Re: [plt-scheme] eval & syntax-rules
> From: robby at eecs.northwestern.edu
> To: skeptic2000 at hotmail.com
> CC: plt-scheme at list.cs.brown.edu
> 
> This expression:
> 
>  (let ([t 2])
>      (eval t (make-base-namespace)))
> 
> is equivalent to this one:
> 
>   (eval 2 (make-base-namespace))
> 
> I think you probably meant to write this:
> 
>  (let ([t 2])
>      (eval 't (make-base-namespace)))
> 
> Eval is not what you think it is, I'd say. It isn't like ruby's eval,
> for example.  There are lots of discussions of this in the mail
> archives for this list and some of them may even have made it into the
> Guide.
> 
> Robby
> 
> On Tue, Apr 20, 2010 at 11:13 AM, Skeptic . <skeptic2000 at hotmail.com> wrote:
> >
> > Hi,
> > Why something like this works :
> > #lang scheme
> > (define t 9)
> > (let ([t 2])
> >     (eval t (make-base-namespace)))
> > -> 2
> > but not something like this :
> > #lang scheme
> > (define a 4)
> > (define b 5)
> > (define c 6)
> > (define-syntax test
> >   (syntax-rules ()
> >     [(test id ...)
> >      (eval '(id ...) (make-base-namespace))]))
> > (test a b c)
> > ->  reference to a unidentified identifier : a
> > Thanks.
> > ________________________________
> > Gardez le contact. Obtenez la version mobile de Messenger ici
> > _________________________________________________
> >  For list-related administrative tasks:
> >  http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> >
 		 	   		  
_________________________________________________________________
Messenger sur votre téléphone = MI sur la route 
http://go.microsoft.com/?linkid=9724474
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100420/370f0a91/attachment.html>

Posted on the users mailing list.