caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: David Teller <David.Teller@univ-orleans.fr>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] [OSR] Exceptionless error management, take 2
Date: Thu, 07 Feb 2008 16:52:37 +0100	[thread overview]
Message-ID: <1202399557.6084.24.camel@Blefuscu> (raw)
In-Reply-To: <20080208.001729.233402575.garrigue@math.nagoya-u.ac.jp>

On Fri, 2008-02-08 at 00:17 +0900, Jacques Garrigue wrote:
> I have little to say about the approach itself (it may certainly be
> good to know that there are no hidden exceptions.)
> 
> However, the comments at the end look just like copied from Vincent
> Hanquez's mail.
> For me, points 2 and 3 make no sense at all.
> Polymorphic variants allow to check exhaustiveness... as long as you
> use exhaustive pattern matching (i.e. no wildcard, exactly like for
> normal variants.)
> And they _cannot_ pollute any namespace, since they define nothing.
> The other points are subjective.
> 
> Jacques Garrigue

Indeed, they are mostly copied from that mail.

You are correct, the remark about pollution was hasty, I've just removed
it. As for allowing to check exhaustiveness, I grant you that I should
have formulated this differently, but the truth remains that in presence
of wildcards, polymorphic variants allows the very same kind of errors
I'm trying to prevent in this candidate.

For instance, let's consider the following extract:

val parse_int : string -> (int, [`Syntax | `Overflow]) may_fail

match result (parse_int "523.5") with
 | Success i              -> (*...*)
 | Error `IncorrectSyntax -> (*...*)
 | _ as e                 -> throw e

This code is perfectly legitimate. It just happens that it's also false,
because we have used the wrong exception name. It's also the kind of
code which I expect will be quite common: deal with one kind of error
and ignore (or re-raise) the others.

So, while polymorphic variants are quite powerful and quite useful, I
also believe they're the wrong tool for the task.

As for points 1 and 4 are subjective, well, they're open for debate.

Cheers,
 David

-- 
David Teller
 Security of Distributed Systems
  http://www.univ-orleans.fr/lifo/Members/David.Teller
 Angry researcher: French Universities need reforms, but the LRU act
brings liquidations. 


  parent reply	other threads:[~2008-02-07 15:52 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-07 15:01 David Teller
2008-02-07 15:09 ` [Caml-list] " Vincent Hanquez
2008-02-07 16:40   ` David Teller
2008-02-07 15:17 ` Jacques Garrigue
2008-02-07 15:22   ` Jon Harrop
2008-02-08  9:54     ` Vincent Hanquez
2008-02-07 15:52   ` David Teller [this message]
2008-02-07 16:06     ` Olivier Andrieu
2008-02-07 16:23       ` David Teller
2008-02-08  9:53   ` Vincent Hanquez
2008-02-08 10:52     ` rlehy
2008-02-08 11:56       ` Vincent Hanquez
2008-02-08 12:40         ` Bünzli Daniel
2008-02-08 15:39           ` David Teller
2008-02-08 17:06             ` Eric Cooper
2008-02-08 20:02               ` David Teller
2008-02-08 19:29             ` Bünzli Daniel
2008-02-08 21:13               ` David Teller
2008-02-10 12:35           ` Vincent Hanquez
2008-02-08 19:07     ` Jon Harrop
2008-02-10 11:58       ` Vincent Hanquez
2008-02-10 16:51       ` Matthew William Cox
2008-02-07 15:33 ` Jon Harrop
2008-02-07 16:25   ` David Teller
2008-02-07 23:10 ` David Teller
2008-02-10 18:47 ` Yaron Minsky
2008-02-10 22:05   ` David Teller
2008-02-11  2:16     ` Yaron Minsky
2008-02-11  8:45       ` David Teller
2008-02-11 12:12         ` Yaron Minsky
2008-02-11 12:53           ` David Teller
2008-02-11 23:09             ` Yaron Minsky

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=1202399557.6084.24.camel@Blefuscu \
    --to=david.teller@univ-orleans.fr \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).