From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 9106F7EE5B for ; Tue, 27 May 2014 23:52:33 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=pra; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=mailfrom; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.webfaction.com) identity=helo; client-ip=74.55.86.74; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="postmaster@smtp.webfaction.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnwBAI0IhVNKN1ZKlWdsb2JhbABZhxuqYpRQAYEiDgEBAQEHDQkJEiqCJQEBBAEjBCAyEAsaAiYCAkcQBhuIMggEsRKFNJ8PF4EqjHUzB4J1NoEVAQOgRxePdg X-IPAS-Result: AnwBAI0IhVNKN1ZKlWdsb2JhbABZhxuqYpRQAYEiDgEBAQEHDQkJEiqCJQEBBAEjBCAyEAsaAiYCAkcQBhuIMggEsRKFNJ8PF4EqjHUzB4J1NoEVAQOgRxePdg X-IronPort-AV: E=Sophos;i="4.98,922,1392159600"; d="scan'208";a="76706827" Received: from mail6.webfaction.com (HELO smtp.webfaction.com) ([74.55.86.74]) by mail2-smtp-roc.national.inria.fr with ESMTP; 27 May 2014 23:52:32 +0200 Received: from [172.20.10.2] (196-227.197-178.cust.bluewin.ch [178.197.227.196]) by smtp.webfaction.com (Postfix) with ESMTP id E618F2129EB2; Tue, 27 May 2014 21:51:54 +0000 (UTC) Date: Tue, 27 May 2014 23:51:53 +0200 From: =?utf-8?Q?Daniel_B=C3=BCnzli?= To: Nicolas Boulay Cc: Philippe Veber , Ben Millwood , Romain Bardou , caml users Message-ID: <9DB91B50B5AC4E5BB27A20B7BCAC2F16@erratique.ch> In-Reply-To: References: <53835610.9050609@inria.fr> <53B801AD6F5B4BFBA0DA2A69D8775497@erratique.ch> X-Mailer: sparrow 1.6.4 (build 1178) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [Caml-list] Uncaught exceptions in function type. Le mardi, 27 mai 2014 =C3=A0 11:25, Nicolas Boulay a =C3=A9crit : > > Because that would be utterly annoying. You need to make the following = distinctions: >=20=20 > Yes it could be annoying, but very high quality software become much hard= er to write. Refactoring is harder. Missing exception handler are harder to= find. That=E2=80=99s non sense. What would the programmer do if Array.create woul= dn=E2=80=99t raise in case of invalid argument 99.9999999% of the code woul= d read like this:=20=20 let a =3D match Array.create n with=20=20 | None -> assert false=20=20 | Some a -> a=20=20 in You solved absolutely nothing by having an option type here. But you did ma= nage to be annoying. =20=20 >=20=20 > > * Exceptional errors, for errors that the programmer is unlikely to han= dle at all (e.g. out of memory). For that raise a custom exception. This sh= ould occur very rarely, you are unlikely to ever define one such exception. >=20=20 > That means intensive testing to be sur to avoid such failure for normal u= ser input. For most long running programme (server, gui), that's could a pr= oblem. >=20=20 > For example, an undo/redo use lot of memory after some copy/paste on big = data, then the save command have not enough memory to work, and the file ar= e troncated. That's not acceptable, and can be see only with big data, afte= r few high level command run. That is certainly not something you want to solve by handling exceptions bu= t by making sure/designing your program is able to function under a given f= ixed memory budget (if only to be able to test the error condition).=20=20 Best, Daniel