caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David House <dhouse@janestreet.com>
To: "Török Edwin" <edwin+ml-ocaml@etorok.net>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] Lazyness and exceptions
Date: Thu, 22 Nov 2012 10:37:23 +0000	[thread overview]
Message-ID: <CAK=fH+jJF4FoW1zrFBem6cLhkmdA8FpU0ofmFdrAJTkECFU1dw@mail.gmail.com> (raw)
In-Reply-To: <50ADFF81.4000300@etorok.net>

In other words: what alternative semantics would you actually want?

On Thu, Nov 22, 2012 at 10:33 AM, Török Edwin <edwin+ml-ocaml@etorok.net> wrote:
> 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
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

  reply	other threads:[~2012-11-22 10:37 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
2012-11-22 10:37   ` David House [this message]
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='CAK=fH+jJF4FoW1zrFBem6cLhkmdA8FpU0ofmFdrAJTkECFU1dw@mail.gmail.com' \
    --to=dhouse@janestreet.com \
    --cc=caml-list@inria.fr \
    --cc=edwin+ml-ocaml@etorok.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).