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 4EE707EE7C for ; Wed, 27 Apr 2016 11:43:23 +0200 (CEST) IronPort-PHdr: 9a23:nzFhXB+dgRlEvf9uRHKM819IXTAuvvDOBiVQ1KB91egcTK2v8tzYMVDF4r011RmSDdWdu6sP0rOempujcFJDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXsq3G/pQQfBg/4fVIsYL+lSsiC1o/ujqibwN76XUZhvHKFe7R8LRG7/036l/I9ps9cEJs30QbDuXBSeu5blitCLFOXmAvgtI/rpMYwu3cYh/V0/MdFVeD+fr8kZb1eFjUvdW4vt+PxshyWbwKE/2YRSSA2nxxSAkDn6wzgUp73+n/4v+FkxSSBeM37S6o1Hzal8r1nQRnAjiAdMjc9/XrKkop3lq0N80HpnAB234OBONLdD/F5ZK6IJd4= Authentication-Results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=jacques-henri.jourdan@normalesup.org; spf=Neutral smtp.mailfrom=jacques-henri.jourdan@normalesup.org; spf=None smtp.helo=postmaster@ulminfo.fr Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of jacques-henri.jourdan@normalesup.org) identity=pra; client-ip=5.135.188.139; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="jacques-henri.jourdan@normalesup.org"; x-conformance=sidf_compatible Received-SPF: Neutral (mail2-smtp-roc.national.inria.fr: domain of jacques-henri.jourdan@normalesup.org does not assert whether or not 5.135.188.139 is permitted sender) identity=mailfrom; client-ip=5.135.188.139; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="jacques-henri.jourdan@normalesup.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@ulminfo.fr) identity=helo; client-ip=5.135.188.139; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="jacques-henri.jourdan@normalesup.org"; x-sender="postmaster@ulminfo.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CABQA5iSBX/4u8hwVegzhpulIOgXSGDwIIgTE4FAEBAQEBAQEBZCdBDgGBXYIVAQEEIwRREQsYCRYEBwICCQMCAQIBRRMIAogmBLM6kVgIiWqBAoUJF4IdglYFmBCDKIFnkkKFV48wHgFDgjaBN4Yhg3cBAQE X-IPAS-Result: A0CABQA5iSBX/4u8hwVegzhpulIOgXSGDwIIgTE4FAEBAQEBAQEBZCdBDgGBXYIVAQEEIwRREQsYCRYEBwICCQMCAQIBRRMIAogmBLM6kVgIiWqBAoUJF4IdglYFmBCDKIFnkkKFV48wHgFDgjaBN4Yhg3cBAQE X-IronPort-AV: E=Sophos;i="5.24,540,1454972400"; d="asc'?scan'208";a="216018176" Received: from ulminfo.fr ([5.135.188.139]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 27 Apr 2016 11:43:22 +0200 Received: from [139.19.168.24] (wks-50-27.mpi-sws.org [139.19.168.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ulminfo.fr (Postfix) with ESMTPSA id 80AA4C0901 for ; Wed, 27 Apr 2016 11:43:20 +0200 (CEST) To: caml-list@inria.fr References: <572084CC.1080408@libertysurf.fr> <32C540F73D89478D9E6D2AF2599F639F@erratique.ch> From: Jacques-Henri Jourdan Message-ID: <572089B8.8090207@normalesup.org> Date: Wed, 27 Apr 2016 11:43:20 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <32C540F73D89478D9E6D2AF2599F639F@erratique.ch> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DAMIQT5KBdGJTufip7uqQshibBofptGxm" Subject: Re: [Caml-list] ocaml 4.03 and warning 52 : argument of this constructor should not be matched against a constant pattern This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --DAMIQT5KBdGJTufip7uqQshibBofptGxm Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 04/27/2016 11:36 AM, Daniel B=C3=BCnzli wrote: > Le mercredi, 27 avril 2016 =C3=A0 11:22, William a =C3=A9crit : >> How are we supposed to handle this nicely with the standard library ? Is >> there a better approach to catch those exceptions ? > Capture them immediately around the function call that raises with a _ pa= ttern.=20=20 > For example:=20=20 > > match (try Some (List.hd lst) with Failure _ -> None) with > | None -> Printf.printf "empty list\n" > | Some hd -> =E2=80=A6 > > That's the way these functions should have been defined in the first plac= e. > > Best,=20=20 > > Daniel > > > Or, with the new pattern matching with exception syntax : match List.hd lst with | exception Failure _ -> Printf.printf "empty list\n" | hd -> ... --DAMIQT5KBdGJTufip7uqQshibBofptGxm Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEbBAEBCAAGBQJXIIm4AAoJEGHoGlEY1GjFJqgH9RC3i+u+oAPwDQLpZXEw+/eX 5hVwCJTMky1bvPafXIwC+S9oMi5tEDPD0x1dENBiP6E6uaXBF2HAg/7nHtIcewk+ XZk6MaFUS32hkvkrJUkSBoZUUJsgMOrvXCJWN7rkBXUWxV47lWXJ32Ni/hTKRn0y KVBMRrCEN14GnJ3vABjWOYe1leoaz/A6D254Onf5BZlG5z5nfJZkLjHdVqmNlsUR sI/loC1E7aQqQx8/TDhfYCdQQipuo0UU747RQTzOTEbzFiVzyJoIWZDkl8E1MdVy zhlpkIZyQ8HJpLIqcmyUv1rpue8sWtCbG7duOBfOZkDJYHU9VspISo6jdsMYDg== =0qgS -----END PGP SIGNATURE----- --DAMIQT5KBdGJTufip7uqQshibBofptGxm--