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

multiple values proposal



   From: Pavel Curtis <Pavel@parc.xerox.com>
   Sender: Pavel Curtis <pavel@parc.xerox.com>
   Fake-Sender: pavel@parc.xerox.com
   References: <9303181830.AA29543@quilty.Stanford.EDU>
	   <93Mar18.102123pst.58372@mu.parc.xerox.com>
   Date: 	Thu, 18 Mar 1993 10:48:45 PST

   > 	   (call-with-values (lambda ()
   > 			       (call-with-current-continuation
   > 				 (lambda (k)
   > 				   (k 1 2 3))))
   > 	     (lambda (a b c)
   > 	       . . .))
   >
   >    And now, this looks to me like code that's entirely legal under the
   >    description that was posted.
   > 
   > I have to disagree.  I do not see how this is legal under the
   > description posted.   According to the description: "Except for
   > continuations created by the call-with-values procedure, all
   > continuations take exactly one value."  Since k is not a continuation
   > created by the call-with-values procedure, it must accept exactly one
   > value, making (k 1 2 3) an illegal expression.  Could someone please
   > clarify?

   But k is exactly the continuation created by CALL-WITH-VALUES.  Remember,
   CALL-WITH-CURRENT-CONTINUATION never creates a new continuation but rather
   simply reifies the one it was called with.  There are only a very small set of
   contexts in Scheme that can in any way be said to create new continuations:

	   1) Argument position in a call
	   2) Procedure position in a call
	   3) The second subform of a SET! form
	   4) The first subform of an IF form
	   5) So-called `command' position in a LAMBDA form
	      (i.e., body forms other than the last one)

   and now

	   6) Invocation of the first argument to CALL-WITH-VALUES

   Every other context merely passes along an existing continuation.

   Does this make it clearer?

Yes.  It was not clear to me that the wording "Except for
continuations created by the call-with-values procedure, all
continuations take exactly one value" was refering to this
continuation.  I realize that cwcc just reifies an existing
continuation, but I found the above wording less than illuminating.  I
would suggest that an example similar to the one I gave above be
included in R5RS in order to demonstrate what is meant by the magic
phrase. 
--------------------
Morry Katz
katz@cs.stanford.edu
--------------------