From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id CAA15157; Thu, 19 Jul 2001 02:10:15 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id CAA15153 for ; Thu, 19 Jul 2001 02:10:14 +0200 (MET DST) Received: from zcars0mt. (h181s242a129n47.user.nortelnetworks.com [47.129.242.181]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f6J0ADX14943 for ; Thu, 19 Jul 2001 02:10:13 +0200 (MET DST) Received: by zcars0mt. (SMI-8.6/SMI-SVR4) id UAA20121; Wed, 18 Jul 2001 20:07:01 -0400 Date: Wed, 18 Jul 2001 20:07:01 -0400 Message-Id: <200107190007.UAA20121@zcars0mt.> To: "'caml-list@inria.fr'" From: "Krishnaswami, Neel" Subject: [Caml-list] Are multiple return values optimized? Content-Type: text/plain; Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello, Are multiple return values optimized to avoid heap-allocation like curried functions are? In Scheme and Lisp, I'm used to an expression like (define foo (lambda () (values 1 2 3))) (call-with-values foo (lambda (x y z) (+ x y z)) evaluating without doing any heap-allocation. Will the analgous OCaml let foo() = (1, 2, 3) let x, y, z = foo() in x + y + z also pass values on the stack or will a tuple be heap-allocated? Simple experiments with ocamlopt -S suggest the latter, but it's possible that there are optimized cases that I don't know how to write. -- Neel Krishnaswami neelk@cswcasa.com ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr