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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 1F0597EE5B for ; Tue, 27 May 2014 23:39:23 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=pra; client-ip=74.55.86.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of daniel.buenzli@erratique.ch) identity=mailfrom; client-ip=74.55.86.74; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="daniel.buenzli@erratique.ch"; x-sender="daniel.buenzli@erratique.ch"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp.webfaction.com) identity=helo; client-ip=74.55.86.74; receiver=mail3-smtp-sop.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: AnwBABIFhVNKN1ZKlWdsb2JhbABZhxuqYpRQAYEjDgEBAQEHDQkJEiqCJQEBBAEjVgULCxoCJgICRxAGG4gyCASxD6RBF4EqiAmEbDMHgnU2gRUBA6BHF492 X-IPAS-Result: AnwBABIFhVNKN1ZKlWdsb2JhbABZhxuqYpRQAYEjDgEBAQEHDQkJEiqCJQEBBAEjVgULCxoCJgICRxAGG4gyCASxD6RBF4EqiAmEbDMHgnU2gRUBA6BHF492 X-IronPort-AV: E=Sophos;i="4.98,922,1392159600"; d="scan'208";a="64400979" Received: from mail6.webfaction.com (HELO smtp.webfaction.com) ([74.55.86.74]) by mail3-smtp-sop.national.inria.fr with ESMTP; 27 May 2014 23:39:22 +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 CF03920E0F56; Tue, 27 May 2014 21:39:20 +0000 (UTC) Date: Tue, 27 May 2014 23:39:20 +0200 From: =?utf-8?Q?Daniel_B=C3=BCnzli?= To: Goswin von Brederlow Cc: caml-list@inria.fr Message-ID: <244F680EFB184D4693C2F7AAC6889EAE@erratique.ch> In-Reply-To: <20140527084954.GA15848@frosties> References: <53835610.9050609@inria.fr> <53B801AD6F5B4BFBA0DA2A69D8775497@erratique.ch> <20140527084954.GA15848@frosties> 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 10:49, Goswin von Brederlow a =C3=A9crit : > Sometimes arguments are computed and suddenly exceed aceptable > parameters. E.g. the user specifies a data file that needs to be read > into a string. If the file is too large you get Invalid_argument. > Programms can catch and handle such cases, at least to the point of > giving a good error message. Bad api. Neither exceptional error, neither programming error, *should* not= raise Invalid_argument, of course you=E2=80=99ll have to handle it but don= 't forget to send hate emails to the API designer.=20=20 > That is a matter of taste and with recursions in the mix exceptions > can be a great way to abort the recursion while keeping the code flow > simple. They also allow you to use things like List.fold_left and > abort early. It=E2=80=99s not a matter of taste. What you are describing here is usage o= f exceptions by a programmer that wants to shoot himself in the foot. Libra= ries themselves should never disrupt the control flow of clients.=20=20 Best, Daniel