From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions
Date: Mon, 31 May 2010 21:36:07 +0200 [thread overview]
Message-ID: <4C040FA7.6070601@univ-savoie.fr> (raw)
In-Reply-To: <87y6f0cf4p.fsf@frosties.localdomain>
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
> It would be nice if the possible exceptions of a function would be part
> of the type. E.g.
>
> let f1 () = raise Not_found
> val f1 : unit -> 'a [ Not_found ]
>
> let f2 () = try f1 () with Not_found -> ()
> val f2 : unit -> unit
>
> let f3 f = try f () with Not_found -> ()
> val f3: (unit -> 'a [< Not_found | 'B ]) -> 'a [ 'B ]
>
> and so on.
>
This is what PML does ... and what is nice is that is does not even
require the exception to be garded ...
>
> Someone would have to write a new type system for that though.
>
Yes, but this require very little new technology : a function having one
type or two as return type is basically the same ...
and polymorphic variant are very well suited to be the default practice
for exception (as in your f3 example).
The only questions (I think) are
- complexity of the algorithm (I think it shoud be OK)
- readability of inferred types (one could hide exception types by
default ?)
Cheers,
Christophe
> MfG
> Goswin
>
> _______________________________________________
> 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
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
next prev parent reply other threads:[~2010-05-31 19:36 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
2010-05-26 17:30 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
2010-06-01 19:08 Peter Ronnquist
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=4C040FA7.6070601@univ-savoie.fr \
--to=christophe.raffalli@univ-savoie.fr \
--cc=caml-list@yquem.inria.fr \
/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