On Thu, 4 Nov 2004, Thomas Fischbacher wrote:
>
>
> On Wed, 3 Nov 2004, Rahul Jain wrote:
>
> > > Would it be feasible to add full continuation support to CMU CL?
> >
> > How would you implement unwind-protect correctly? How would you
> > _specify_ a correct implementation of unwind-protect?
>
> You mean, does the unwind-protected code get re-started when you re-enter
> a certain point of execution via resuming a continuation and then exit
> again?
>
> I don't see a problem in re-doing the unwind-protected stuff once again.
> Sure, this would mean that unwind-protect and continuations could not be
> mixed as freely as one might want. But what one would like to have in the
> end is dynamic-wind, anyway, so I really do not see why this particular
> maybe-not-so-nice linguistic feature of CL should bar the introduction of
> a different very powerful and useful concept.
>
As for as I know, there are many problems when definining the semantics
of dynamic-wind correctly in Scheme. Fo example, assume you opened some
file when entering it for the first time (and closed when leaving
dynamic-wind scope). Now you reenter by continuation, but the file does
not exist -- you cannot say you are in the same computation context.
One may try to prevent removing files for which access by cotinuation
exists, but what would you do if the file is on remote computer and
this computer has been switched off in the meantime.
For me, dynamic-wind has MUCH MORE power than unwind-protect, because it
is the construction for reentering previous computation contexts.
On the contrary, UNWIND-PROTECT only serves to safely leave contexts, so
it has much simpler semantics. I doubt we want to have dynamic-wind in
place of unwind-protect in CL, at least not until Scheme community comes
up with verifiable full semantics for dynamic-wind :-(and I doubt, whether
it is possible to define all kinds of side-effects and how to reasonably
restore the state for them).
Regards,
Zbyszek Jurkiewicz