From: Jason Smith <jns28@student.canterbury.ac.nz>
To: Richard Jones <rich@annexia.org>, skaller@users.sourceforge.net
Cc: caml-list <caml-list@pauillac.inria.fr>
Subject: RE: [Caml-list] laziness
Date: Mon, 06 Sep 2004 21:07:34 +1200 [thread overview]
Message-ID: <413A8C36@webmail> (raw)
>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 = <long computation>
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
next reply other threads:[~2004-09-06 9:07 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-06 9:07 Jason Smith [this message]
2004-09-06 10:18 ` skaller
-- strict thread matches above, loose matches on Subject: below --
2004-09-06 12:17 Jason Smith
2004-09-06 17:00 ` skaller
2004-09-06 9:16 Jason Smith
2004-09-05 1:07 Jason Smith
2004-09-05 5:46 ` skaller
2004-09-06 0:57 ` Richard Jones
2004-09-06 6:11 ` Nicolas Cannasse
2004-09-06 8:24 ` skaller
2004-09-06 8:44 ` Erik de Castro Lopo
2004-09-06 12:55 ` Jon Harrop
2004-09-06 16:21 ` William Lovas
2004-09-06 22:35 ` Hartmann Schaffer
2004-09-07 8:31 ` Richard Jones
2004-09-07 8:37 ` Nicolas Cannasse
2004-09-04 6:30 skaller
2004-09-04 8:40 ` Marcin 'Qrczak' Kowalczyk
2004-09-04 11:21 ` skaller
2004-09-04 11:49 ` Richard Jones
2004-09-04 20:40 ` Hartmann Schaffer
2004-09-05 10:50 ` Jon Harrop
2004-09-05 14:07 ` skaller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=413A8C36@webmail \
--to=jns28@student.canterbury.ac.nz \
--cc=caml-list@pauillac.inria.fr \
--cc=rich@annexia.org \
--cc=skaller@users.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).