[R6RS] Convenient syntax for multiple values

Michael Sperber sperber
Thu Dec 16 05:38:03 EST 2004


>>>>> "Manuel" == Manuel Serrano <Manuel.Serrano at sophia.inria.fr> writes:

Manuel> I have the impression that the LET-VALUES form more or less implies
Manuel> that, at some point, multiple values are represented by lists. 
Manuel> I dislike that. 

Manuel> I find pretty unpleasing that as soon as I say something there is
Manuel> someone here to answer something such as "no because in my clever
Manuel> implementation the form blabla is efficiently implemented as ...".  I
Manuel> find this very unpleasing and I feel that it is time for me to
Manuel> react. I don't think that I have to be lectured on how to implement
Manuel> Scheme efficiently. If you think I do, go to the shootout benchmarks
Manuel> page, submit your implementation and compare it with Bigloo. Alternatively,
Manuel> please send me your papers demonstrating better performance than Bigloo.

I'm sorry---my tone was out of line.  It wasn't my intention to
lecture. 

I am curious how you got to your impression, as no implementation I
know (including the SRFI reference implementation) implies that
"multiple values are represented by lists."

Manuel> For your information, in Bigloo, the form:

Manuel> (multiple-value-bind (a b c)
Manuel>   (foo bar)
Manuel>   (list a b c))

Manuel> requires no allocation (except, of course, the construction of the
Manuel> list).  In particular, FOO does not allocate any data structure. I
Manuel> think this is no so easy to get such efficiency with LET-VALUES,
Manuel> especially in the context of an interpreter that cannot afford
Manuel> sophisticated optimization.

I don't see how MULTIPLE-VALUE-BIND generates code that's different
from that generated by LET-VALUES in

(let-values (((a b c) (foo bar)))
  (list a b c))

The reference implementation macro-expands this into

(call-with-values
 (lambda () (foo bar))
 (lambda (x1 x2 x3) ((lambda (a b c) (begin (list a b c))) x1 x2 x3)))

There's no additional list allocation involved.

-- 
Cheers =8-} Mike
Friede, V?lkerverst?ndigung und ?berhaupt blabla


More information about the R6RS mailing list