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

mv continuations

      From ramsdell@linus.mitre.org  Wed Aug 30 07:09:54 1989
                   ...I think I get your point.  What the proposal should
      say is that values could be defined as:
      (define (values . args)
          (lambda (cont) (apply cont args))))

      and with-values creates a continuation with arity exactly matching the
      arity of the receiver...

Not so fine.  I think we should avoid saying anything about the "arity" of
such continuations.  The proposal goes on to say:
      Returns the result of applying the procedure 'receiver' to the values
      produced by calling procedure 'generator' with no arguments.  It is an
      error if 'receiver' cannot be applied to the number of values returned
      by 'generator' or if 'generator' cannot be called with zero arguments.

Here it seems that it is the procedure call that is source of any arity
errors, not the continuation itself.  It is quite reasonable for the
continuation itself to be of indefinite arity; in fact, that is way
the current R*S semantics has it, and the way an implementation
might handle it. 

A similar confusion is also apparent in the following:
      Within procedure 'generator', the initial escape procedure returned by
      call-with-current-continuation is 'receiver'.

"receiver" just evaluates to a value; it may or may not be an "escape
procedure."  The continuation created by "with-values" for the invocation
of "generator" is not the same as the value returned by "receiver."
The continuation is rather the application of the value returned by
"receiver" to the values returned by "generator" plus the continuation
of the call to "with-values."