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

Re: multiple values



>> From: Alan Bawden <bawden@arisia.xerox.com>
...
>> So is this a permissible implementation of your proposal?  It seems to me
>> that it must be since you only try to specify what happens if other than
>> one value is returned to WITH-VALUES, and nowhere else.
>> 
>> (define magic-multiple-values-marker (list '* 'multiple 'values '*))
>> 
>> (define (values . vals)
>>   (if (= 1 (length vals))
>>       (car vals)
>>       (cons magic-multiple-values-marker vals)))
>> 
>> (define (with-values thunk receive)
>>   (let ((result (thunk)))
>>     (if (and (pair? result)
>> 	     (eq? (car result) magic-multiple-values-marker))
>> 	(apply receive (cdr result))
>> 	(receive result))))

The above looks to me to be a legal implementation of the proposal.
Alan has shown the ease in which all Scheme implementations can
be modified so as to correctly implement multiple values.  Of course,
programmers using quality implementations can expect much better code 
to be generated from optimizing compilers.

Leaving the arity of ordinary continuations unspecified is a bit
unsettling, however, I believe it to be the only viable way of
reaching agreement on this subject.  I hope this compromise will not
be the last word on the subject of multiple values, but a base on
which we build future agreements.  Now is the time to crawl; only
later should we try to walk.  Let's wait for Kent's words.

Don't panic,

John