On Fri, Feb 20, 2009 at 11:03:50AM -0600, Grant Rettke wrote:
> It seems like part of learning Scheme is internalizing the notion that
> every procedure secretly has a continuation passed to it, and that is
> how we can understand that the result of the last expression is
> "returned" (iow applied to the secret continuation). Additionally we
> need this to visualize how call/cc works.
> 
> That said, I wonder what is the rationale for leaving the result of
> passing multiple values to a continuation unspecified when it is a
> function like any other?

While I like the idea of returning multiple values from a procedure,
in practice they "feel" kind of clunky (although SRFI-8's RECEIVE
makes it _almost_ smooth enough).  I like the idea of returning
multiple values since it is conceptually very different from returning
one compound value containing these values.

Having said that, I've come to suspect that perhaps representing
continuations as procedures is a mistake (albeit a small one).
They're not (or don't have to be) procedures.  Marc Feeley made a
nice proposal back in 2001 to change the representation of
continuations in his short paper "A Better API for First-Class
Continuations"[1].  In the paper it is argued that not representing
them as procedures is both more flexible and possibly more efficient.

If this API would be slightly modified to allow only one value as
argument to CONTINUATION-RETURN and taken in the Scheme report as
being the "core" continuations API, the need for conceptual symmetry
between calling a procedure with multiple values and passing multiple
values to a continuation simply disappears because continuations would
no longer be thought of as procedures.

In fact, it would make the language simpler (if slightly larger; 3
procedures is more than one) because you wouldn't have different *kinds*
of continuations (accepting different numbers of values); they would
all just accept 1 value because the API only allows one value.

Just my 2 cents.

[1] http://repository.readscheme.org/ftp/papers/sw2001/feeley.pdf

Cheers,
Peter Bex
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpDqgnsVCx28.pgp
Description: PGP signature

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to