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 WAA26338; Sat, 4 Sep 2004 22:41:53 +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 WAA24923 for ; Sat, 4 Sep 2004 22:41:52 +0200 (MET DST) Received: from juliet.albedo.net (juliet.albedo.net [206.51.22.2]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i84KfpkZ012027 for ; Sat, 4 Sep 2004 22:41:51 +0200 Received: from albedo.net (ppp146.albedo.net [206.51.22.146]) (authenticated bits=0) by juliet.albedo.net (8.12.11/8.12.3) with ESMTP id i84KfXNE001772; Sat, 4 Sep 2004 16:41:35 -0400 Message-ID: <413A2822.3030408@albedo.net> Date: Sat, 04 Sep 2004 16:40:02 -0400 From: Hartmann Schaffer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5 X-Accept-Language: en-ca, en-us, de MIME-Version: 1.0 To: skaller@users.sourceforge.net CC: "Marcin 'Qrczak' Kowalczyk" , caml-list@pauillac.inria.fr Subject: Re: [Caml-list] laziness References: <1094279400.3352.240.camel@pelican.wigram> <87656u2zrk.fsf@qrnik.zagroda> <1094296869.3352.280.camel@pelican.wigram> In-Reply-To: <1094296869.3352.280.camel@pelican.wigram> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamd / ClamAV version 0.74, clamav-milter version 0.74a on juliet X-Virus-Status: Clean X-Miltered: at nez-perce with ID 413A288F.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; schaffer:99 schaffer:99 caml-list:01 2004:99 marcin:01 'qrczak':01 kowalczyk:01 sourceforge:01 inlined:01 inlining:01 conforms:01 unspecified:01 inlining:01 compiler:01 semantics:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk skaller wrote: >On Sat, 2004-09-04 at 18:40, Marcin 'Qrczak' Kowalczyk wrote: > > >>skaller writes: >> >> >> >>>However if the call is *inlined* to get >>> >>> if c' then a' else b' >>> >>>then perhaps a' or b' will never be evaluated. >>> >>> >>No. Inlining is considered an optimization, which implies that it >>doesn't change the semantics except when it was not fully specified >>in the first place. >> >> > >I understand that argument -- but that doesn't mean the >compiler conforms to the specification, nor that the >specification is best. > > > >>E.g. the order of evaluation of arguments is >>unspecified, so it might be different depending on inlining; but >>OCaml does specify that each argument are evaluated exactly once >>and inlining doesn't change that. >> >> > >Must they be evaluated before the function is called? > > > on the first pass, yes (in order maintain the meaning of the code). depending on the optimizer, later optimizations might be able to suppress some of the evaluations (e.g. if the value of c' can be determined at compile time) hs ------------------- 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/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners