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

Amended WITH-VALUES and VALUES.



>> In a compromise everyone gives in a little.  I don't see you doing
>> that.
>> 
>> The semantics that I want is that extra values are truncated when
>> returned to implicit continuations.  As a compromise, I accept strict
>> semantics as long as ACCEPTS? is provided.  I'm trying to compromise,
>> you are trying to have me surrender.
>> 
>> 

As Jqnathan Rees points out, the proposal should explicitly say
something about what the arity of implicit continuations.  My
compromise proposal says nothing about that subject because I thought
it would eliminate the chance of reaching an agreement.  I have an
opinion on the subject, but I will not propose it in the interest of
getting multiple values into Scheme.  Implementations may explore many
alteratives.  With the current proposal, implementation may or may not
ignore extra values returned by a procedure.  All it requires is that
the number of arguments generated by the first argument of WITH-VALUES
matches the arity of the second argument of WITH-VALUES, and (values
E) returns E.  To make the situation about VALUES clear, I added a note
to that section.

I leave unspecified the behavior of the following code:

		(list (values 1 2))

John

------------------------------ Amended WITH-VALUES Proposal.

(values obj ...)                                        essential procedure

Returns 0 or more values to a receiving procedure (See with-values).

        (values)        =>              returns zero (no) values

        (values 1)      =>              returns a single value, 1

        (values 1 'a) 	=>              returns two values, 1 and the symbol a

Note: When applied to one argument, values simply returns its argument.

(with-values generator receiver)      			essential procedure

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.

        (with-values 
          (lambda ()
            (values 1 2))
	  cons)   	      =>              (1 . 2)

--------------------------------