Jane Street's Core seems to prefer options to exceptions On Wed, May 26, 2010 at 5:10 PM, Hans Ole Rafaelsen <hrafael...@gmail.com>wrote:
> > > On Wed, May 26, 2010 at 7:30 PM, Dario Teixeira > <darioteixe...@yahoo.com>wrote: > >> Hi, >> >> > What experience does people have to using alternatives to exceptions, >> > such as option types or exception monads? Does use of third part >> > libraries that still throws exceptions make such approaches hard to use? >> > Performance wise it seems to be comparable to catching exceptions or >> > matching for options, so I guess the difference be might a question of >> > programming style? >> >> Partly yes, though I would say that in Ocaml it is tempting to use >> exceptions beyond what is reasonable, because they are so cheap and >> convenient. As you noted, this can lead to trouble at runtime, which >> is why some libraries discourage the "exceptional style", preferring >> option types and forcing users to invoke functions suffixed by "_exc" >> if they really want to use the exception-based version. >> >> Personally, I think the litmus test hinges on whether the supposedly >> exceptional situation is truly worthy of the name. If it's a common >> occurrence, perhaps one should reconsider the use of an "exception". >> Without meaning to start an holy war, let me just add that even on >> the Stdlib there are functions (such as Map.S.find) that raise an >> exception but which should perhaps return an option type. >> >> Btw, you didn't mention it explicitly in your message, but I trust you >> are familiar with "Catch me if you can"? [1] >> > I have just read about it, not tested it yet. Do you have any experience > using this library, especially together with other libraries that also > provides syntax extension? > > >> >> Best regards, >> Dario Teixeira >> >> [1] >> http://dutherenverseauborddelatable.wordpress.com/downloads/exception-monads-for-ocaml/ >> >> >> >> >> Thanks, > > Hans Ole > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >
_______________________________________________ Caml-list mailing list. Subscription management: http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list Archives: http://caml.inria.fr Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs