[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
will the real current continuation please stand up
The main difference that I see between CALL-WITH-CURRENT-CONTINUATION
and CURRENT-CONTINUATION is that when CURRENT-CONTINUATION is used,
the continuation returned has already been invoked (namely to return
itself), thus any further (explicit) invocations are additional
invocations. In the CALL-WITH-CURRENT-CONTINUATION world this
continuation has not yet been "used". While there is no difference if
continuations are re-entrant (they can be invoked more than once),
CURRENT-CONTINUATION can only be used under this assumption.
As far as HUDAK@YALE's original question: He distinguished between the
continuation to the CALL-WITH-CURRENT-CONTINUATION invocation (outer
continuation), and the continuation to the argument (inner
continuation), but the way I see it both are the same. The
continuation-passing definition of CALL-WITH-CURRENT-CONTINUATION that
I use is:
(define (call-with-current-continuation *cont* receiver)
(receiver *cont* *cont*))
where procedures always receive an additional argument (the first)
which is the implicit continuation. Clearly then both continuations
(outer and inner) are the same. In other words, since
CALL-WITH-CURRENT-CONTINUATION reduces (tail-recurses) into its
argument, the continuations are the same.