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 (10:18)
From: skaller <skaller@u...>
Subject: RE: [Caml-list] laziness
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,
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: