Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: [Caml-list] laziness
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] laziness
On Mon, 2004-09-06 at 10:57, Richard Jones wrote:

> Doesn't laziness often indicate a bug in the code?  ie.  You've
> written an expression in the program, but that expression is never
> used.  This is dead code, right?  Hence a bug?

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.

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.

-- 
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