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 LAA01189; Mon, 6 Sep 2004 11:07:40 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA01614 for ; Mon, 6 Sep 2004 11:07:39 +0200 (MET DST) Received: from regyva.canterbury.ac.nz (regyva.canterbury.ac.nz [132.181.2.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id i8697bkP020284 for ; Mon, 6 Sep 2004 11:07:38 +0200 Received: from CONVERSION-A1.it.canterbury.ac.nz by it.canterbury.ac.nz (PMDF V6.2-X27 #30791) id <01LEK7H6JIOWDXXLX9@it.canterbury.ac.nz> for caml-list@pauillac.inria.fr; Mon, 06 Sep 2004 21:07:32 +1200 (NEW ZEALAND STANDARD TIME) Received: from webmail (cantwm.giga.canterbury.ac.nz [132.181.2.26]) by it.canterbury.ac.nz (PMDF V6.2-X27 #30791) with ESMTP id <01LEK7H7NYX6DWPIOS@it.canterbury.ac.nz>; Mon, 06 Sep 2004 21:07:34 +1200 (NEW ZEALAND STANDARD TIME) Date: Mon, 06 Sep 2004 21:07:34 +1200 From: Jason Smith Subject: RE: [Caml-list] laziness To: Richard Jones , skaller@users.sourceforge.net Cc: caml-list Message-id: <413A8C36@webmail> MIME-version: 1.0 X-Mailer: WebMail (Hydra) SMTP v3.61 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7bit X-WebMail-UserID: jns28 X-EXP32-SerialNo: 00002797 X-Miltered: at concorde with ID 413C28D9.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; jns:99 canterbury:99 caml-list:01 eagerly:01 bug:01 bug:01 debugging:01 compiler:01 compiler:01 trivial:01 side-effects:02 lazy:02 lazy:02 harder:02 laziness:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk >But that dead code if executed eagerly will result >in a value stored in a variable which is never used. >So the code is still 'dead code' and still a bug >(assuming it is a bug) whether evaluation is eager >or lazy. This is where dead code elimination comes into play. A trivial optimization performed by the GHC compiler. e.g. let x = y = ... in ...y.... we can remove 'x'. Again, side-effects make this harder in o'caml. >Actually the lazy case might make it easier to >track this down by adding a debugging print >in the expression -- in the eager case you get >a diagnostic but can't deduce the result is used, >in the lazy case you know the result is being used >when you get the diagnostic. The compiler should optimize it out. There shouldn't be any need for using explicit print statements. Jason. ------------------- 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