guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Procedure proposal: call-with-escape-procedure


From: Marius Vollmer
Subject: Re: Procedure proposal: call-with-escape-procedure
Date: 13 Mar 2001 19:09:52 +0100
User-agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.7

Miroslav Silovic <address@hidden> writes:

> Basically I'm still unsure if call/ec gains anything, compared to
> dynamic-wind that just signals an error from its setup thunk if it's
> reentered.

Such a dynmic-wind, that can only be entered once, would prevent the
use of continuations in ways that are useful and save, even for code
that wants the escape-protect semantics.  For example, one could use
continuations to implement coroutines, and coroutines would not
interfere with the assumptions of code that uses escape-protect.

> It seems good if call/cc is used to escape from within call/ec but
> there is some way to *ensure* that the execution will return inside
> call/ec (because otherwise you miss the cleanup).

Yes.  I think there is no way to make the guarantee that control will
return from within the language, but this guarantee can be provided by
the writer of the code that uses call/cc or call/ec.  Using call/ec
expresses the guarantee that control will not return, while using
call/cc at least gives the hint that control is likely to return.

One can of course use call/cc and not let the control return, but one
shouldn't.  That's the main reason for providing call/ec: so that the
programmer can better express what he wants to achieve.  What he wants
to achieve matters to the rest of the system, so this expressibility
is important to provide in the system.

Call/ec and escape-protect are library features provided on top of
call/ec and dynamic-wind.  As such, they are not essential since
everybody could implement them themselves.  However, for exceptions,
it is important that all code uses the _same_ implementation, else
different modules wouldn't interoperate right.

This is where the exception mechanism differs from hash tables, say.
If Guile wouldn't have hash tables, every user could implement them
himself, without much consequences.  Not so with an exception system,
since multiple, non-interacting exception systems are no good.

Further, I'd say that call/cc and dynamic-wind are not enough alone,
because they are too general.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]