[plt-scheme] Self evaluating "objects"

From: Jos Koot (jos.koot at telefonica.net)
Date: Mon Jul 14 10:32:47 EDT 2008

In mzscheme (at top level only!!!)

(begin
 (define x 3)
 (eval 'x)) --> 3

With mzscheme at all levels

 (begin
   (define x 3)
   (eval 'x (scheme-report-environment 5)))

x is evaluated in a fresh namespace. I have played with namespaces a lot, 
but eventually I have been converted to modules and no longer use eval.

Jos

----- Original Message ----- 
From: "Cristian Baboi" <cristian.baboi at gmail.com>
To: "Jos Koot" <jos.koot at telefonica.net>; <plt-scheme at list.cs.brown.edu>
Sent: Monday, July 14, 2008 4:22 PM
Subject: Re: [plt-scheme] Self evaluating "objects"


> On Mon, 14 Jul 2008 13:01:10 +0300, Jos Koot <jos.koot at telefonica.net> 
> wrote:
>
>
>> BTW both R5RS and R6RS require two arguments for eval (the expression to 
>> be evaluated and an environment)
>
> Some more examples:
>
> (begin
> (define x 3)
> (eval 'x (scheme-report-environment 5))
> )
>
> (begin
> (define x 3)
> (eval 'x (interaction-environment))
> )
>
> both return 3 in Gambit-C, but the first gives "reference to undefined 
> identifier: x" in PLT 



Posted on the users mailing list.