[plt-scheme] passing multiple "values" between functions

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Mon Apr 6 07:49:42 EDT 2009

On Apr 6, 2009, at 4:24 AM, Jakub Piotr Cłapa wrote:

> On 4/6/09 9:23 AM, Martin DeMello wrote:
>> that there is no "values" object that you can pass around till you're
>> ready to unpack it. Do values offer any advantage over using lists  
>> and
>> let-match?
>
> AFAIK returning multiple values does not require allocation (no  
> consing) and destructuring (the values go straight to the bindings).

See Dybvig's analysis and experiments concerning this 'conjecture.'  
Turns out that for an 'optimizing' compiler (such as Chez) the major  
difference concern error reporting. (Think (let* ((x f returns (cons  
1 2))) (a (car x)) (d (cdr x))) ...) can be optimized reasonably w/o  
allocation.)

-- Matthias



Posted on the users mailing list.