Le Tue, 04 Feb 2014, Jeremy Yallop a écrit : > The recent thread about the representation of options highlighted a > shortcoming in the "try" construct: there isn't a convenient way to > express code that should run when the body of the "try" doesn't raise > an exception. > > I'd like to propose extending OCaml with a design once suggested by > Christophe Raffalli which elegantly handles this case. The details, > along with an implementation that you can try out, are in the > following blog post: > > http://ocamllabs.github.io/compiler-hacking/2014/02/04/handler-case.html > > Feedback welcome! This is very nice and detailed, but I'm not sure to follow how this is supposed to help in some cases you mention. Namely, the match (try Some (foo) with End_of_foo -> None) with | Some x -> a | None -> b transformation is used to preserve tail-call. Would the new try foo with | End_of_foo -> b | val x -> a present the same behavior w.r.t tail-call? If the answer is yes, then I find it very interesting :) -- Simon