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

Re: Multiple values for R4RS.



>> I'm not sure how this circumvents the "controversial" aspects.  As I
>> understood it, the controversy had to do with the semantics of how
>> VALUES interacted with the continuation in effect where it was called.

Given Shaff's proposal, I thought the controversy was just over
ACCEPTS?.  I thought the "obvious" semantics implied by the
denotational semantics had finally been accepted.  Maybe I am wrong.

>> 
>>    [...]
>> 
>>    (apply-values receiver generator)
>> 
>> I've been using a similar interface for multiple values for about a
>> year now, the major difference being that instead of `apply-values'
>> there is an operation `with-values' which has these two arguments in
>> the opposite order.  

I too prefer the arguments in reverse order so that the most straight
forward extension of apply-values is to make a CPS style call. 

(apply-value generator receiver . generator-args)

or using other names

(apply-values procedure continuation . procedure-args)
[continuation here means a procedure representing a continuation].

I thought the order of arguments is not important enought to stand in
the way of agreement.  Maybe I am wrong.

>> From: Warren Harris <harris%hplwhh@hplabs.hp.com>
>> 
>> Your proposal doesn't say what happens when the number of values
>> expected by the receiver is different from the number the generator
>> produces.  

Sure it does.  It clearly states "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".  Warren, please
reread my proposal.
 
>> From: Guillermo J. Rozas <jinx@hpesogg.hp.com>
>>
>> I don't think they are worth adding if ACCEPTS? is not included as
>> well.  
....
>> Without ACCEPTS?, their use and functionality can be provided in user
>> code, although without the error checking or the efficiency of a
>> "native" implementation.

The point is that by adding just VALUES and APPLY-VALUES, programmers
can depend on the efficiency and error checking of a "native"
implementation. 

John

---- Amended multiple values proposal.

(values obj ...)                                        essential procedure

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

        (values)        =>              returns zero (no) values

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

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


(apply-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.

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

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