Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2004-09-06 (08:24)
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,
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: