POS, OOFS, CL v Scheme, etc.

Chris Bitmead uid chris.bitmead@Alcatel.com.au
Wed, 14 May 1997 11:00:42 +1000


>Note that recently bound dynamic variables are found very fast,
>they are at the top of the stack.

If I start talking about dynamic variables, I'll probably be talking
nonsense, but here goes...

Can't dynamic variables be implemented efficiently by storing the
current value in the global place, and pushing the old global value on
the stack. When the local binding of the variable goes out of scope
you pop the old value off the stack and replace the global position
with the original value. Thus lookups are always constant and fast.

It's a bit the opposite of what most languages do, by making the
global storage the local lookup, and pushing the old values on the
stack, rather than the new ones.