From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p8DJHaKE007802 for ; Tue, 13 Sep 2011 21:17:40 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhMEAFmrb05ZELGagWdsb2JhbABCmHGEaokUgRUBARYmJoFTAQEEATo0CwULCyUhRRIGExKHZQICt0+GDmAEkz2FOItr X-IronPort-AV: E=Sophos;i="4.68,375,1312149600"; d="scan'208";a="108910462" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail4-smtp-sop.national.inria.fr with SMTP; 13 Sep 2011 21:17:40 +0200 Received: (qmail 3000 invoked by uid 634); 13 Sep 2011 19:17:39 -0000 X-Spam-Level: * X-Spam-Check-By: dark.recoil.org Received: from Unknown (HELO [10.236.89.248]) (82.132.249.249) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.83) with ESMTPA; Tue, 13 Sep 2011 20:17:39 +0100 References: <20110913183714.GA15241@yeeloong.happyleptic.org> In-Reply-To: <20110913183714.GA15241@yeeloong.happyleptic.org> Mime-Version: 1.0 (iPhone Mail 8L1) Content-Type: text/plain; charset=us-ascii Message-Id: <807250F7-599D-4D0D-9397-8A376DC727CA@recoil.org> Cc: "caml-list@inria.fr" X-Mailer: iPhone Mail (8L1) From: Anil Madhavapeddy Date: Tue, 13 Sep 2011 20:17:24 +0100 To: "rixed@happyleptic.org" X-Virus-Checked: Checked by ClamAV on dark.recoil.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p8DJHaKE007802 Subject: Re: [Caml-list] Lwt and exceptions Yes, it's essential to do this for many common functions such as Hashtbl.find. The nice thing about Lwt is that you control yielding, so as long as you catch the exception locally and "convert" it into the Lwt monad, everything works great. The occasional exception leak is really hard to track down though, if you let one propagate by mistake. Ban OCaml exceptions! :) Anil On 13 Sep 2011, at 19:37, rixed@happyleptic.org wrote: > The Lwt doc states that you should not use "raise" when using Lwt > but use Lwt.fail instead. > > So, is it still OK to call functions (for instance from the stdlib) > that may raise an exception, provided we catch it soon enough ? > And by "soon enough" I mean: before an Lwt call that could schedule > another thread. > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa-roc.inria.fr/wws/info/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >