caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] Static exception analysis or alternative to using exceptions
@ 2010-05-26 17:30 Dario Teixeira
  2010-05-26 21:10 ` Hans Ole Rafaelsen
  0 siblings, 1 reply; 26+ messages in thread
From: Dario Teixeira @ 2010-05-26 17:30 UTC (permalink / raw)
  To: Hans Ole Rafaelsen; +Cc: caml-list

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]

Best regards,
Dario Teixeira

[1] http://dutherenverseauborddelatable.wordpress.com/downloads/exception-monads-for-ocaml/



     


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Re: [Caml-list] Static exception analysis or alternative to using exceptions
@ 2010-06-01 19:08 Peter Ronnquist
  0 siblings, 0 replies; 26+ messages in thread
From: Peter Ronnquist @ 2010-06-01 19:08 UTC (permalink / raw)
  To: caml-list


Richard Jones wrote:
"... All in all, this is not ideal for writing correct programs.  Some sort
of exception analysis would be most welcome."

Doesn't the "catch me if you can" library provide this? 

Among the listed features are:
  * case coverage (i.e. the compiler can tell you if you forgot a case or sometimes if you wrote useless ones)

Isn't it so that the "catch me if you can" library solves most (all?) problems related to error handling through exceptions in ocaml?
(The "Batteries included" project has listed it as a possible inclusion
for future versions (http://www.cocan.org/osr/batteriesincluded)

Regards
Peter R



      


^ permalink raw reply	[flat|nested] 26+ messages in thread
* Static exception analysis or alternative to using exceptions
@ 2010-05-26 16:15 Hans Ole Rafaelsen
  2010-05-27  9:34 ` [Caml-list] " Alain Frisch
  2010-05-27 17:01 ` Richard Jones
  0 siblings, 2 replies; 26+ messages in thread
From: Hans Ole Rafaelsen @ 2010-05-26 16:15 UTC (permalink / raw)
  To: caml-list

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

Hi,

when running server software, it is quite frustrating when the program
crashes due to an uncaught exception. I see there was some attempts on doing
static analysis of the exception flow in programs around 10 years ago (such
as ttp://pauillac.inria.fr/caml/ocamlexc/ocamlexc.htm), but they did not
seem to be complete and now seem to be dropped. Is there some technical
reason for not having static exception analyses, or can we hope that some
day in the future, Ocaml will support static exception analysis?

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?


Thanks,

Hans Ole Rafaelsen

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

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2010-06-08  9:16 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-26 17:30 [Caml-list] Static exception analysis or alternative to using exceptions Dario Teixeira
2010-05-26 21:10 ` Hans Ole Rafaelsen
2010-05-27  3:37   ` Jacques Le Normand
2010-05-27  8:08     ` Florent Ouchet
2010-05-27  8:50       ` Eray Ozkural
2010-05-27 11:10         ` Florent Ouchet
2010-05-27  8:54       ` David Allsopp
2010-05-27  9:11         ` Mark Shinwell
2010-05-27  9:29           ` David Allsopp
2010-05-27  9:12         ` Daniel Bünzli
2010-05-27  9:19           ` David Allsopp
2010-05-27  9:15       ` David Rajchenbach-Teller
2010-05-27 13:56     ` Hezekiah M. Carty
  -- strict thread matches above, loose matches on Subject: below --
2010-06-01 19:08 Peter Ronnquist
2010-05-26 16:15 Hans Ole Rafaelsen
2010-05-27  9:34 ` [Caml-list] " Alain Frisch
2010-05-27 17:01 ` Richard Jones
2010-05-27 21:13   ` Dario Teixeira
2010-05-31 14:36   ` Goswin von Brederlow
2010-05-31 15:00     ` Florent Ouchet
2010-05-31 17:24     ` David Allsopp
2010-05-31 20:51       ` Török Edwin
2010-06-08  9:16       ` Goswin von Brederlow
2010-05-31 19:30     ` Nicolas Pouillard
2010-05-31 20:57       ` Lukasz Stafiniak
2010-05-31 21:42         ` blue storm
2010-05-31 19:36     ` Christophe Raffalli

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).