[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Demystifying Continuations
>>>>> "DS" == David Simmons <David.Simmons@smallscript.net> writes:
DS> Continuations are usually talked about in Procedural language settings,
DS> not Object Oriented settings. Specifically because a continuation is
DS> easily implemented as a goto.
DS> One of the reasons the picture becomes complex in the OO world is
DS> because of all the throw/unwind logic. For historical purposes, I would
DS> say that a 'normal' continuation would NOT unwind, but would indeed
Have you studied the interaction between
(dynamic-wind before thunk after)
and call-with-current-continuation in Scheme? Scheme is not
object-oriented, but of course has continuations and, more recently,
the notion of unwind protected blocks. The R5RS definition of Scheme
can be found at these fine websites:
Some of the relevant text is:
BEFORE is called whenever execution enters the dynamic extent of
the call to THUNK and AFTER is called whenever it exits that
dynamic extent. The dynamic extent of a procedure call is the
period between when the call is initiated and when it returns.
In Scheme, because of `call-with-current-continuation', the
dynamic extent of a call may not be a single, connected time
period. It is defined as follows:
* The dynamic extent is entered when execution of the body of
the called procedure begins.
* The dynamic extent is also entered when execution is not
within the dynamic extent and a continuation is invoked that
was captured (using `call-with-current-continuation') during
the dynamic extent.
* It is exited when the called procedure returns.
* It is also exited when execution is within the dynamic extent
and a continuation is invoked that was captured while not
within the dynamic extent.
Greg email@example.com (617)253-5807