[plt-scheme] eval and interaction-enviroment in R5RS

From: Bas Steunebrink (bass at cs.uu.nl)
Date: Fri Nov 7 03:14:09 EST 2008

Hi all,

I was a bit puzzled when I tried the following code in DrScheme:

(define x 0)
(let ((x 1))
    (eval '(set! x 2) (interaction-environment))
    x)
x

When running this in R5RS mode, it outputs 1 and then 2, while I would 
expect 2 and then 0. About interaction-environment, R5RS states that 
"The intent is that this procedure will return the environment in which 
the implementation would evaluate expressions dynamically typed by the 
user". So I expected the set! expression to work on the local x 
variable, while PLT appears to take the top-level one. What do you think?

Bas



Posted on the users mailing list.