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

Re: Vectors as functions

On Monday, August 18, 2003, at 09:29 AM, Joe Marshall wrote:

>>> every time.  It absolutely destroys any sort of compiler 
>>> optimization.
>> Actually it doesn't. In this case your variable lookup becomes the
>> exact same problem as method lookup in Self, which has been
>> successfully optimized.
> Well, I'm overstating the problem, but only a little.  Variable lookup
> can be a significant bottleneck if you have to deep search each and
> every time you refer to a variable. In Scheme, every LET expression
> introduces a new lexical contour, and if you had no guarantee that
> the user won't change one arbitrarily, you cannot `flatten' them,
> fold `constants', eliminate common subexpressions, etc.

Yes but as I said this is exactly the same situation as in Self, just 
map Scheme scope onto Self object. Self is often able to optimize away 
lookup even though the programmer can dynamically, and at any level of 
the lookup, add new bindings and even change parents (which would be 
equivalent to changing the enclosing lexical contexts) or add parents. 
And in fact Self makes the receiver object one of the levels of scope 
so that instance variables and methods can be found without having to 
specify 'self' explicitly. So in other words Self is already doing what 
you are talking about and it is optimizing it.

--- james mccartney