caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: Chris King <colanderman@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Today's inflamatory opinion: exceptions are bad
Date: Mon, 11 Dec 2006 15:55:13 +0000	[thread overview]
Message-ID: <20061211155513.GA22044@furbychan.cocan.org> (raw)
In-Reply-To: <875c7e070612101527j3d649226y3cade255af0cd6cd@mail.gmail.com>

On Sun, Dec 10, 2006 at 06:27:37PM -0500, Chris King wrote:
> On 12/10/06, Richard Jones <rich@annexia.org> wrote:
> >On Sat, Dec 09, 2006 at 10:35:56PM -0500, Chris King wrote:
> >> One thing Java (sort of) gets right is keeping track of which
> >> exceptions a function can throw, making it easy to ensure that some
> >> deeply nested piece of code won't cause the entire application to die
> >> from some obscure exception.  I'd love to see a similar feature in
> >> O'Caml, whereby the exceptions which a function can raise are part of
> >> its type and are inferred and checked by the compiler.
> >
> >Oh please no!  Checked exceptions are the dumbest and most frustrating
> >feature of Java (and that's saying something - the Java language has
> >far more frustrations than most programming languages).

I'll moderate what I said before by adding that I now think there are
some exceptions which should never be ignored - for example, it seems
like it's always a mistake to ignore Not_found or End_of_file.  On the
other hand I would almost always want to ignore Sys_error, or else
catch it far away from its point of origin in a wrapper around the
whole program or an event handler.

Perhaps though this is an argument that List.find and friends should
be returning 'a option, not an argument for all exceptions being bad.

> I fully agree.  Forcing the programmer to acknowledge the presence of
> every possible exception is annoying to write and makes for fragile
> code.  Hence I suggested exception inference... no extra effort is
> required on the part of the programmer and the code is not made
> fragile.  O'Caml provides the safety of checked types without the
> hassle of type declarations; in the same way it could provide the
> safety of checked exceptions without the hassle of exception
> declarations.

Agreed.  I'd like to see a detailed prototype.

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Internet Marketing and AdWords courses - http://merjis.com/courses - NEW!
Merjis blog - http://blog.merjis.com - NEW!


  reply	other threads:[~2006-12-11 15:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-10  1:42 Brian Hurt
2006-12-10  2:40 ` [Caml-list] " skaller
2006-12-10  2:51 ` Martin Jambon
2006-12-10  3:35 ` Chris King
2006-12-10  6:32   ` Jon Harrop
2006-12-10 19:07     ` brogoff
2006-12-10 18:04   ` Richard Jones
2006-12-10 23:27     ` Chris King
2006-12-11 15:55       ` Richard Jones [this message]
2006-12-15 11:13         ` Frédéric Gava
2006-12-11 17:28     ` Mike Lin
2006-12-11 20:09       ` Richard Jones
2006-12-11 23:38   ` Olivier Andrieu
     [not found]   ` <C841DA73-83D4-4CDD-BF4A-EA803C6D6A08@vub.ac.be>
2006-12-23  4:23     ` Ocaml checked exceptions Chris King
2006-12-10  6:30 ` [Caml-list] Today's inflamatory opinion: exceptions are bad malc
2006-12-10  6:36   ` malc
2006-12-10  6:56 ` Jon Harrop
2006-12-10  9:51 ` Andreas Rossberg
2006-12-10 11:00   ` Tom
2006-12-10 11:25     ` Andreas Rossberg
2006-12-10 13:27   ` Jean-Christophe Filliatre
2006-12-10 19:15     ` Haoyang Wang
2006-12-10 21:43       ` Jean-Christophe Filliatre
2006-12-11 13:10       ` Diego Olivier FERNANDEZ PONS
2006-12-10 18:31   ` Serge Aleynikov

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=20061211155513.GA22044@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=caml-list@inria.fr \
    --cc=colanderman@gmail.com \
    /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).