[r6rs-discuss] Continuations....

From: <bear>
Date: Sat Feb 10 16:37:11 2007

On Sun, 28 Jan 2007, Thomas Lord wrote:

>.... should clearly be an optional feature of the language.

No, I don't think they should. There is no other construct
that has precisely the kind of capabilities that continuations
offer.

I agree that they're sharp, and can unintentionally cut
abstraction barriers or expose details; but in the absence
of an equivalent, mathematically "clean" alternative for
abstractions of control flow, I cannot support getting
rid of them.

Perhaps we should discuss how they could be reformulated
to be less prone to causing problems.

I think they're easier to understand (and therefore less
prone to confusion and misuse) as a procedure binding
introduced by the lambda of the call they escape from.
For example I think it would be reasonable to say

(define foo
  (lambda (bar foo (cc baz))
    ... body... ))

to introduce a <body> in which the variable 'baz' is
bound to the continuation that terminates the body. It
would also be much handier with multiple returns,
because "multiple returns" just means calling baz with
more than one argument. Also, it gets a lot easier to
define what is an "escape continuation" as compared
to a "generalized" continuation.

In addition to trivializing multiple returns (which
otherwise require a special form) It's trivial to prove
that this lambda-initialized form has the power of
call/cc:

;;; use with caution!
(define call/cc (lambda (argproc (cc cont))
   (argproc cont)))

That said, I don't think making massive changes to the
way continuations work is appropriate for a revision
that is also doing so much else.

                        Bear
Received on Sat Feb 10 2007 - 16:36:54 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:01 UTC