From: Mehdi Dogguy <mehdi@dogguy.org>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Lwt and exceptions
Date: Thu, 15 Sep 2011 12:04:40 +0200 [thread overview]
Message-ID: <4E71CDB8.5020704@dogguy.org> (raw)
In-Reply-To: <20110913183714.GA15241@yeeloong.happyleptic.org>
On 13/09/2011 20: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.
>
I guess, not (and it has been answered already). In fact, I was wondering
if Lwt's authors would be against adding a function like:
let wrap f x = try Lwt.return (f x) with e -> Lwt.fail e
It is stupid, trivial, etc… but looks what we need most of the time, no?
Instead of doing it in our own code, it could land in Lwt directly.
But, if it gets integrated into Lwt proper, users should be warned about
its behaviour. (especially with impure functions).
Regards,
--
Mehdi Dogguy مهدي الدڤي
http://dogguy.org/
next prev parent reply other threads:[~2011-09-15 10:05 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
2011-09-14 16:15 ` rixed
2011-09-15 12:24 ` Jérémie Dimino
2011-09-15 10:04 ` Mehdi Dogguy [this message]
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=4E71CDB8.5020704@dogguy.org \
--to=mehdi@dogguy.org \
--cc=caml-list@inria.fr \
/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