On Sat, Jun 08, 2002 at 02:29:53PM -0400, Dan Sugalski wrote:
> There's more than just exception handlers going on the control stack. 
> Anything that needs rolling back or undoing (like localized variables 
> or scope entry) will have an undo marker put on the control stack 
> that gets called when we pop its entry off the control stack. It's an 
> easy way to remember overwritten values--you put an "overwritten" 
> entry on the control stack with the old value, and we restore it when 
> we pop the entry off the stack.

With co-routines and callcc, function start and end are not always
properly nested.  For instance, you can start a co-routine, enter a
function, run the co-routine until it ends and then exit the function.
Or you can capture the current continuation inside a function and
resume it until it exits the function, and then resume it again.

So I don't think pushing undo markers on the control stack will work.
Maybe we should implement something like Scheme's dynamic-wind.  (See
ftp.cs.indiana.edu/pub/scheme-repository/doc/standards/june-92-meeting.ps.gz
and
http://groups.google.com/groups?selm=izvhr5y4jy.fsf%40ux01.CS.Princeton.EDU
for two differents implentations of dynamic-wind.)

-- Jero;e

Reply via email to