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

Re: multiple values proposal

> Date:	Thu, 18 Mar 1993 10:30:21 -0800
> From:	Morry Katz <katz@quilty.stanford.edu>
>    The second is that the call to VALUES is in argument position and so
>    certainly returns the wrong number of values for its continuation.
> I really am not sure what the syntax is supposed to be when passing
> multiple values to a continuation, but I agree that Pavel's syntax is
> preferable to mine.

It's not a question of any new syntax, though.  Continuations are just
procedures, so you pass multiple arguments to them in the usual way.

> 	   (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?