POS, OOFS, CL v Scheme, etc.

Henry G. Baker hbaker@netcom.com
Tue, 13 May 1997 18:38:28 -0700 (PDT)


> >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.

Yes, you just described 'shallow binding'.  In fact, there isn't a
hard requirement for doing _either_ 'shallow' or 'deep' binding, but
one can shift back an forth at will.  See

ftp://ftp.netcom.com/pub/hb/hbaker/ShallowBinding.html  (also .ps.Z)

for more details.  This is the essense of the Scheme 'state space'
stuff.

-- 
Henry Baker
www/ftp directory URL:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html