On 13/09/2011 20:37, ri...@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/

-- 
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 via email to