caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Mike Lin <mlin@mlin.net>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] Lwt and exceptions (2015)
Date: Tue, 7 Jul 2015 05:40:18 +0000	[thread overview]
Message-ID: <BAY176-W30339E26747DB8EBA3CCFBAB920@phx.gbl> (raw)

[-- Attachment #1: Type: text/plain, Size: 982 bytes --]

Dear all,
I've long been observing the admonishment to avoid raising native exceptions in Lwt code [1,2]. However, it has not escaped my notice that between Lwt.catch, the try%lwt syntax extension, and the fact that Lwt.bind sets up a handler for native exceptions raised in asynchronous callbacks [3], they're usually handled just as one would naively expect. Actually, I spent a little time trying to come up with a non-terribly-contrived example where using a native exception breaks the intended handling logic, and did not succeed...
Perhaps the situation has evolved over time as some of the aforementioned features have been added to Lwt. Can anyone venture to define precisely when it's wrong to raise native exceptions in Lwt code, as of 2015?
[1] https://mirage.io/wiki/tutorial-lwt[2] http://caml-list.inria.narkive.com/YRIVPWeD/lwt-and-exceptions[3] https://github.com/ocsigen/lwt/blob/bb75e9185e2cf9a71d13b5008d08dae8fdc90f4d/src/core/lwt.ml#L653
Mike
 		 	   		  

[-- Attachment #2: Type: text/html, Size: 1341 bytes --]

             reply	other threads:[~2015-07-07  5:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-07  5:40 Mike Lin [this message]
2015-07-13 20:01 ` Andreas Hauptmann

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=BAY176-W30339E26747DB8EBA3CCFBAB920@phx.gbl \
    --to=mlin@mlin.net \
    --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;
as well as URLs for NNTP newsgroup(s).