caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anil Madhavapeddy <anil@recoil.org>
To: "rixed@happyleptic.org" <rixed@happyleptic.org>
Cc: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] Lwt and exceptions
Date: Tue, 13 Sep 2011 20:17:24 +0100	[thread overview]
Message-ID: <807250F7-599D-4D0D-9397-8A376DC727CA@recoil.org> (raw)
In-Reply-To: <20110913183714.GA15241@yeeloong.happyleptic.org>

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
> 


  reply	other threads:[~2011-09-13 19:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-13 18:37 rixed
2011-09-13 19:17 ` Anil Madhavapeddy [this message]
2011-09-14 16:15   ` rixed
2011-09-15 12:24     ` Jérémie Dimino
2011-09-15 10:04 ` Mehdi Dogguy
2011-09-15 10:35   ` Anil Madhavapeddy
2011-09-15 12:09   ` Jérémie Dimino
2011-09-15 12:33     ` Mehdi Dogguy
2011-09-15 12:22   ` Dmitry Grebeniuk
2011-09-15 13:10     ` Jérémie Dimino
2011-09-17  6:38       ` Dmitry Grebeniuk
2011-09-17  9:23         ` Stéphane Glondu
2011-09-17 10:20         ` Jérémie Dimino

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=807250F7-599D-4D0D-9397-8A376DC727CA@recoil.org \
    --to=anil@recoil.org \
    --cc=caml-list@inria.fr \
    --cc=rixed@happyleptic.org \
    /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).