From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id AB6DF7EDC3 for ; Thu, 22 Nov 2012 11:57:53 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of Jean-vincent.Loddo@lipn.univ-paris13.fr) identity=pra; client-ip=194.254.163.15; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-vincent.Loddo@lipn.univ-paris13.fr"; x-sender="Jean-vincent.Loddo@lipn.univ-paris13.fr"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of Jean-vincent.Loddo@lipn.univ-paris13.fr) identity=mailfrom; client-ip=194.254.163.15; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-vincent.Loddo@lipn.univ-paris13.fr"; x-sender="Jean-vincent.Loddo@lipn.univ-paris13.fr"; x-conformance=sidf_compatible Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail.lipn.univ-paris13.fr) identity=helo; client-ip=194.254.163.15; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="Jean-vincent.Loddo@lipn.univ-paris13.fr"; x-sender="postmaster@mail.lipn.univ-paris13.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiUDAP4DrlDC/qMPgWdsb2JhbABEhUdaqTmSWw4BARYmJ4IeAQEFDBcPAQU2GwQFAhgCAgkdAgJFEgYTCAqHaQMTB60FiRsDiV6BIosSgSqCFIETA5V/gRySFQ X-IronPort-AV: E=Sophos;i="4.83,299,1352070000"; d="scan'208";a="182689657" Received: from gw.lipn.univ-paris13.fr (HELO mail.lipn.univ-paris13.fr) ([194.254.163.15]) by mail1-smtp-roc.national.inria.fr with ESMTP; 22 Nov 2012 11:57:53 +0100 Received: from webmail.lipn.univ-paris13.fr (lipn-webmail [10.10.0.93]) by mail.lipn.univ-paris13.fr (Postfix) with ESMTP id 1B8EAC002 for ; Thu, 22 Nov 2012 11:57:53 +0100 (CET) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Date: Thu, 22 Nov 2012 11:57:53 +0100 From: Jean-vincent.Loddo@lipn.univ-paris13.fr To: In-Reply-To: References: <50ADFF81.4000300@etorok.net> Message-ID: X-Sender: loddo@lipn.univ-paris13.fr User-Agent: Roundcube Webmail/0.5.2 X-Validation-by: jean-vincent.loddo@lipn.univ-paris13.fr Subject: Re: [Caml-list] Lazyness and exceptions Ok, I understand now why. In the case of my example this choice could be discussed because of the nature of the output (unit), because it's not clear if the exception belongs to the output domain of the function or not (it's a semantics question). However, in the general case we cannot provide a reasonable output without re-evaluating the expression. Thanks. On Thu, 22 Nov 2012 10:37:23 +0000, David House wrote: > In other words: what alternative semantics would you actually want? > > On Thu, Nov 22, 2012 at 10:33 AM, Török Edwin > 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.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