[racket] metacircular interpreter, lexical scope, environment

From: YC (yinso.chen at gmail.com)
Date: Wed Dec 1 23:12:17 EST 2010

Thanks Hendrik for both responses - please see inline.

On Wed, Dec 1, 2010 at 7:23 PM, Hendrik Boom <hendrik at topoi.pooq.com> wrote:

>
> The immutable hash table doesn't work well for lexically scoped
> variables.
>
> You can end up with multiple simultaneous bindings of the same
> variable in different contexts.  Look up the Knuth Man-or-boy problem,
> for example, in http://en.wikipedia.org/wiki/Man_or_boy_test


But isn't that what's called for in a chained environment?  The inner can
see the outer bindings if not shadowed, but not vice versa.


> Subsituting them away is a correct, but slow way of implementing lexical
> scoping.  It was invented in the days when mathematicians were inventing
> formal logic, and computers weren't around yet -- more as a way of
> preciely defining concepts tha a way of being practical.  It had a clear
> meaning before side-effects became commonplace.


So what would be a fast way?


> But the activation frame doesn't have to be on the stack.  It could,
> say, be om the heap.


Yes agreed - I don't mean the frames need to be held on "the stack" - I
don't even know if racket's frames are on "the stack".  I just mean that I
need to maintain my own stack of frames instead of relying on racket to do
so.

Thanks,
yc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101201/14d7c863/attachment.html>

Posted on the users mailing list.