[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: first-class names



At 4:20 PM -0400 8/17/03, mike@newhall.net wrote:
>  > What do you mean by "all the costs"?  And what do you mean by
>>  "canonical implementation"?
>>
>>  Cheers =8-} Mike Friede
>
>>From earlier: "Joe Marshall" <jrm@ccs.neu.edu> wrote:
>The biggest problem with first-class environments ala MIT Scheme
>is the introduction of new bindings at runtime.  If you introduce a
>new binding, the `lexical address' (frame and offset) of a variable
>cannot be statically determined and you have to do a deep search
>every time.  It absolutely destroys any sort of compiler optimization.

No, no it doesn't. It does make some things somewhat more difficult, 
and there are some optimizations it forbids but they're generally the 
sort of optimizations you can't do anyway in languages that do this 
sort of thing. (As they normally have user-defined types with 
behavior the compiler can't normally infer well enough to do anything 
with)

If your language has very very small lexical scopes then getting any 
sort of efficiency can be rather memory-intensive, as you need 
phantom entries in your frames, but in languages with larger scopes 
it is generally much less of an issue.
-- 
                                         Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
dan@sidhe.org                         have teddy bears and even
                                       teddy bears get drunk