From: "Török Edwin" <edwin+ml-ocaml@etorok.net>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Lazyness and exceptions
Date: Thu, 22 Nov 2012 12:33:37 +0200 [thread overview]
Message-ID: <50ADFF81.4000300@etorok.net> (raw)
In-Reply-To: <b3cd867690b0f42d9c5a3bb1b22f7b2d@lipn.univ-paris13.fr>
On 11/22/2012 12:29 PM, Jean-vincent.Loddo@lipn.univ-paris13.fr wrote:
> Hello,
>
> I have observed a strange behaviour of lazy values when an exception is raised. Here a minimal code that reproduces the behaviour:
>
> # let action =
> let thunk () =
> Printf.printf "aaa\n";
> failwith "bbb"
> in
> lazy (thunk ());;
>
> val action : unit lazy_t = <lazy>
>
> # Lazy.force action ;;
> aaa
> Exception: Failure "bbb".
>
> # Lazy.force action ;;
> Exception: Failure "bbb".
>
> The lazy value seems to be (correctly) not re-evaluated but the exception is (strangely) raised again. Why does this happen?
Its the documented behavior:
http://caml.inria.fr/pub/docs/manual-ocaml/libref/Lazy.html
Unfortunately the original backtrace will be lost.
--Edwin
next prev parent reply other threads:[~2012-11-22 10:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-22 10:29 Jean-vincent.Loddo
2012-11-22 10:33 ` Török Edwin [this message]
2012-11-22 10:37 ` David House
2012-11-22 10:57 ` Jean-vincent.Loddo
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=50ADFF81.4000300@etorok.net \
--to=edwin+ml-ocaml@etorok.net \
--cc=caml-list@inria.fr \
/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