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 0BEAE7EDC2 for ; Thu, 22 Nov 2012 11:33:40 +0100 (CET) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of edwin+ml-ocaml@etorok.net) identity=pra; client-ip=176.9.138.55; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of edwin+ml-ocaml@etorok.net designates 176.9.138.55 as permitted sender) identity=mailfrom; client-ip=176.9.138.55; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="edwin+ml-ocaml@etorok.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of postmaster@mail.etorok.net designates 176.9.138.55 as permitted sender) identity=helo; client-ip=176.9.138.55; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="edwin+ml-ocaml@etorok.net"; x-sender="postmaster@mail.etorok.net"; x-conformance=sidf_compatible; x-record-type="v=spf1" X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgIFAOH+rVCwCYo3/2dsb2JhbABEgmyDNbt+FnOCHgEBBSMdAQE2Ag8LGAICBRYLAgIJAwIBAgFFEwYCAogKAwesB3CDRwEFjycGgSKLEoEqghSBE5YCgRyPJYJx X-IronPort-AV: E=Sophos;i="4.83,299,1352070000"; d="scan'208";a="182683986" Received: from mail.etorok.net ([176.9.138.55]) by mail1-smtp-roc.national.inria.fr with ESMTP; 22 Nov 2012 11:33:39 +0100 Received: from [IPv6:2a02:2f02:1022:9089:1e6f:65ff:fe23:db0d] (unknown [IPv6:2a02:2f02:1022:9089:1e6f:65ff:fe23:db0d]) by mail.etorok.net (Postfix) with ESMTPSA id B967746AE for ; Thu, 22 Nov 2012 11:33:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=etorok.net; s=MAILOUT; t=1353580418; bh=mmZdaLkY57SY2qDkQV/iAdxBpbkYuRZmC6ol9E5lbVA=; h=Message-ID:Date:From:MIME-Version:To:Subject:References: In-Reply-To:Content-Type:Content-Transfer-Encoding; b=RLiEEeas50QyT6TkilzfDn+ytZvSYRBcva7HDaCbQWXwOmQHkdSVkFW/S5pn0zIuz 0c/BqieobEDIzKtLwPqDrGogv0xW2tfpi+BeuaNDEDSgsFdng26Keb+ehe63mMIMlZ I2rDLB9LiTrnFeXgQGM1YevBrqdu175JFLe1cbfw= Message-ID: <50ADFF81.4000300@etorok.net> Date: Thu, 22 Nov 2012 12:33:37 +0200 From: =?UTF-8?B?VMO2csO2ayBFZHdpbg==?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.10) Gecko/20121027 Icedove/10.0.10 MIME-Version: 1.0 To: caml-list@inria.fr References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.6 at mail X-Virus-Status: Clean Subject: Re: [Caml-list] Lazyness and exceptions 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