|
From: | Chicken Monk |
Subject: | [Chicken-users] Re: eval and local variables |
Date: | Tue, 08 May 2007 12:03:35 -0400 |
User-agent: | Thunderbird 2.0.0.0 (Macintosh/20070326) |
felix winkelmann wrote:
2. Is it possible to get the "local environment" (which should have access to b and c)? Is there even such a thing, or am I seeing this completely wrong?This is not possible in general, unless you really want to peek into the internal representation of a closure.
Thank you for your reply, Felix.You'll have to pardon my ignorance... I am used to Python, where "eval" and "exec" have access to all the variables that regular code has, even in nested scopes. So I was wondering if something similar could be done in Scheme.
The way I see it (and which is most likely incorrect :-): regular code has access to variables in the current and enclosing scopes, so the functionality is already there... so maybe it would be possible to have a function (local-environment) that returns an environment containing the local variables? Of course it would need a parent environment, which I don't think environments.egg supports.
I will probably need to take a look at the Chicken source code to see how it's *really* implemented. :)
Oh, which leads me to another question: I am currently using Chicken 2.6. Judging from the change log, a lot has been changed/added since then. Is the development version stable enough to use for everyday coding, or should I stick with the "official" 2.6 for a while?
Thanks, -- Chicken Monk "God loves ya. And she loves me too."
[Prev in Thread] | Current Thread | [Next in Thread] |