From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id C5DFEBBAF for ; Mon, 31 May 2010 21:36:20 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqECAMyrA0zUGyoFkWdsb2JhbACRci+EUoc1FQEBAQEJCwoHEQMfv0aFFgQ X-IronPort-AV: E=Sophos;i="4.53,335,1272837600"; d="asc'?scan'208";a="60359033" Received: from smtp5-g21.free.fr ([212.27.42.5]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 May 2010 21:36:19 +0200 Received: from macbookpro.local (bin73-1-78-240-16-62.fbx.proxad.net [78.240.16.62]) by smtp5-g21.free.fr (Postfix) with ESMTP id A92A2D48174 for ; Mon, 31 May 2010 21:36:13 +0200 (CEST) Message-ID: <4C040FA7.6070601@univ-savoie.fr> Date: Mon, 31 May 2010 21:36:07 +0200 From: Christophe Raffalli User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; fr; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 MIME-Version: 1.0 To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Static exception analysis or alternative to using exceptions References: <20100527170122.GA28273@annexia.org> <87y6f0cf4p.fsf@frosties.localdomain> In-Reply-To: <87y6f0cf4p.fsf@frosties.localdomain> X-Enigmail-Version: 1.0.1 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig5CDC3FB5F3705B43B9E8641D" X-Spam: no; 0.00; christophe:01 raffalli:01 christophe:01 raffalli:01 univ-savoie:01 val:01 val:01 cheers:01 beginner's:01 ocaml:01 bug:01 mfg:98 polymorphic:01 beginners:01 exception:01 X-Attachments: type="application/pgp-signature" name="signature.asc" name="signature.asc" This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5CDC3FB5F3705B43B9E8641D Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > It would be nice if the possible exceptions of a function would be part= > of the type. E.g. > > let f1 () =3D raise Not_found > val f1 : unit -> 'a [ Not_found ] > > let f2 () =3D try f1 () with Not_found -> () > val f2 : unit -> unit > > let f3 f =3D try f () with Not_found -> () > val f3: (unit -> 'a [< Not_found | 'B ]) -> 'a [ 'B ] > > and so on. > =20 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. > =20 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 ?) =20 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 > =20 --------------enig5CDC3FB5F3705B43B9E8641D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwED6wACgkQi9jr/RgYAS7DRgCfV84lEk/FcKShaJsj4TdlEwIk gakAoLod2i+D+a/rqVWUpV3q22/p4EwB =LQUm -----END PGP SIGNATURE----- --------------enig5CDC3FB5F3705B43B9E8641D--