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 MAA03690; Mon, 6 Sep 2004 12:18:39 +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 MAA04467 for ; Mon, 6 Sep 2004 12:18:38 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i86AIZ19032221 for ; Mon, 6 Sep 2004 12:18:37 +0200 Received: from [192.168.1.200] (ppp210-32.lns2.syd3.internode.on.net [203.122.210.32]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i86AIT4Y041241; Mon, 6 Sep 2004 19:48:29 +0930 (CST) Subject: RE: [Caml-list] laziness From: skaller Reply-To: skaller@users.sourceforge.net To: Jason Smith Cc: Richard Jones , caml-list In-Reply-To: <413A8C36@webmail> References: <413A8C36@webmail> Content-Type: text/plain Message-Id: <1094465907.3352.1093.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 06 Sep 2004 20:18:29 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 413C397B.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 bug:01 optimise:01 optimised:01 debugging:01 debugging:01 9660:01 glebe:01 compiler:01 compiler:01 nsw:01 snail:02 lazy:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, 2004-09-06 at 19:07, Jason Smith wrote: > The compiler should optimize it out. There shouldn't be any need for using > explicit print statements. Yes but the original issue is that the programmer is seeing an expression they expect to be evaluated and it isn't being evaluated -- so there is a bug somewhere. So your point is kind of backwards -- the compiler may well optimise it away, but the programmer is actually looking for evidence that it *isn't* optimised away. In an eager language, no conclusions can be drawn from a debugging output - you still don't know if the returned value is used or not. In a lazy language, debugging output indicates the code *is* being used and hence not dead, and lack of output means it isn't, at least in one particular environment. You might investigate further and discover the result is only used in an unreachable branch of a match, so the code really is dead: that function argument will never be used (so you can remove it, and also the unreachable branch). -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- 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