From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 D9B437F0BA for ; Wed, 8 Feb 2017 14:04:23 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=iguer.auto@gmail.com; spf=Pass smtp.mailfrom=iguer.auto@gmail.com; spf=None smtp.helo=postmaster@mail-wm0-f48.google.com Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of iguer.auto@gmail.com) identity=pra; client-ip=74.125.82.48; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="iguer.auto@gmail.com"; x-sender="iguer.auto@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of iguer.auto@gmail.com designates 74.125.82.48 as permitted sender) identity=mailfrom; client-ip=74.125.82.48; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="iguer.auto@gmail.com"; x-sender="iguer.auto@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-wm0-f48.google.com) identity=helo; client-ip=74.125.82.48; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="iguer.auto@gmail.com"; x-sender="postmaster@mail-wm0-f48.google.com"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AkZUgDBzxjgKeZJnXCy+O+j09IxM/srCxBDY+r6Qd?= =?us-ascii?q?2+wVIJqq85mqBkHD//Il1AaPBtSHraIewLaK+4nbGkU4qa6bt34DdJEeHzQksu?= =?us-ascii?q?4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1?= =?us-ascii?q?Ov71GonPhMiryuy+4ZPebgFHiTanYr5+Mhq6oAreu8ILnYZsN6E9xwfTrHBVYe?= =?us-ascii?q?pW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbf?= =?us-ascii?q?VwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8qBkRQPmhS?= =?us-ascii?q?oFOTM16X3bh8Nth65foB+tuxlzzojJa4+XKfV+ZLvQc80aS2RcXchfWSJODYyg?= =?us-ascii?q?YIUAFOcBIeRVopPhq1cSoxazBw+hD/7vxD9SgX/22LU33eMmEQHGxgMgGswBv2?= =?us-ascii?q?nJp9v2O6cSTP66zLPOzTXHdfxW3S3y45XPfxAgrvGMQKx/cdDLxUY1CgPFklKQ?= =?us-ascii?q?pJfqPzOQzOsNsmyb4/B8WuKojm4qsgd8qSWhyMcrj4nGnIMVylbc+CV9wYY1I9?= =?us-ascii?q?64R1Bmbt6lFptcrT2VN4xzQs86QmFotzs6xaMcuZKhfSgKzponxxnZZveacIaI?= =?us-ascii?q?+gruWeSeLDtimX5pZrKyiwyx/ES+0OHxWcq53E5XoidLndTArG0B2hzR58SdVP?= =?us-ascii?q?dx4F2t1SuO2gzO7OxPPFo6mrDBK5E7x749jpoTvlrHHi/xgEj2ibWZdkQg+uSx?= =?us-ascii?q?5eXnZ6nqqoaSN4J7iQzyKKsumsu4AeQ3NggBQXKX9vi71L3m5UH5QbNKgeMqkq?= =?us-ascii?q?TBsp3XKt4XqrOnDwJVyIou6AizAy2p3dkbhXUHKUhKeBODj4jnIVHOJ/X4AO++?= =?us-ascii?q?g1SjjTdk2erGMqf7DZXQMnjDl6zsfbl460FGyQozycpT6I5TCrEEOP7zQFP+tM?= =?us-ascii?q?TEDh8lNAy52/roB8941oMaQG6PBq6ZMLjOsVKT/eIuI+yMZJcPtzrnKvgl4eTu?= =?us-ascii?q?jX4jllMHc6mpx8hfVHftVP9vJkHcZXv3nv8AF30Lt0wwVqai3FaLVDoWY3epQ4?= =?us-ascii?q?o94Cs6AcSoF9GQaJqqhemk2yeyG5BaLkFJF12WF3Phc4zMD/YDdS+IZMZ8jjss?= =?us-ascii?q?Wr2oSotn3har4lypg4F7J/bZr3VL/ano08J4srCLmA=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0DKBwBfFptYhjBSfUpdHgYMhCcLKl+DW?= =?us-ascii?q?ZpvBoECiRuORiqIXEIVAQEBAQEBAQEBAQESAQEBCAsLCh0kC0IBBAkBgWIKB4J?= =?us-ascii?q?PBBEIARQHHgMSEA8CJgIlEQEFASINCAEBiVcBAwgNDp9vg0A/jAKBaxgFARyDC?= =?us-ascii?q?QWDawoZJw1VgzIBCwEdAgYJAQh5hH2CSQiKPIJfBZtwhm2LJWiJSA+GRpFMMoE?= =?us-ascii?q?VNVxET2iEHiCBbnSELIFDgw8BAQE?= X-IPAS-Result: =?us-ascii?q?A0DKBwBfFptYhjBSfUpdHgYMhCcLKl+DWZpvBoECiRuORiq?= =?us-ascii?q?IXEIVAQEBAQEBAQEBAQESAQEBCAsLCh0kC0IBBAkBgWIKB4JPBBEIARQHHgMSE?= =?us-ascii?q?A8CJgIlEQEFASINCAEBiVcBAwgNDp9vg0A/jAKBaxgFARyDCQWDawoZJw1VgzI?= =?us-ascii?q?BCwEdAgYJAQh5hH2CSQiKPIJfBZtwhm2LJWiJSA+GRpFMMoEVNVxET2iEHiCBb?= =?us-ascii?q?nSELIFDgw8BAQE?= X-IronPort-AV: E=Sophos;i="5.33,346,1477954800"; d="scan'208";a="212497895" Received: from mail-wm0-f48.google.com ([74.125.82.48]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 08 Feb 2017 14:04:23 +0100 Received: by mail-wm0-f48.google.com with SMTP id v186so46628374wmd.0 for ; Wed, 08 Feb 2017 05:04:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=UWSee0/Cu4cOv6+e8eru9TKoFeI2rVckuKQwpv4HHis=; b=amqflRrW7gnjMgOLGAxs79f0tBE7Wryr1RgWHitIyXOekpLxBCKg1U01svd0VPKwzu gAaLbytDkck8EXNrdEyZ+eCgyIOJCidZnTvwsJIxpd0Zn9YN9306nphp0e67ig1ctFKp cw07/sZEBmJhH88xLXbcFqpxdi/fySD3BdtMZeSr93x0SKz2eq0yTQWjIfmbJJyhi3fA 75foiDsKhnr+rn8e42I1Vpb0XnDh383LlxZdQd0vLqRtEZowFFhcvSwtC6trYkfnOoGP VbPeMO0L52CRnmSMelzyoxh/lvv6hWx5urjyOWxyXQcXciZ2K3vyWM8GmM9kLoTMXhjW DdTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=UWSee0/Cu4cOv6+e8eru9TKoFeI2rVckuKQwpv4HHis=; b=rNS3aaRaecVIeBcCnHpH8cRb9IR2siXTQ7eYJbthHmZizSAyGlhJY6boDVHu2jvrgj CtO6EmhZVdmoW6nXxKCR6FCL+axzKftdlskHdQFGXuPnQ9EQO8XRqWF7pPT/VxihbEAu efXbWZIhUedf04+2R8H5OouczUXSmgmvpCu26khW4FWONRLBkaLEKIvbGmjC00LnToKO 80VvJhcx/7WTy5h2jwKKshMy7B2tbCJExbw6/M53S0NjzqYxGgK1seLtfymbjsEs273X TA1lu/CyH3ElnTgcKyrdVixSrUwB0ZUYOjbicwm2Mzc/GryAd50iA5FNG6ZKNPsd6PnD l/FA== X-Gm-Message-State: AMke39kN42Ea7a/tNbKuhinIw8DSWdsycLkNTB5lKDE+v6dQaBNjNPJk4eym25UctIhwqg== X-Received: by 10.28.167.68 with SMTP id q65mr18920148wme.126.1486559062455; Wed, 08 Feb 2017 05:04:22 -0800 (PST) Received: from [134.157.22.161] ([134.157.22.161]) by smtp.gmail.com with ESMTPSA id m188sm3287322wma.0.2017.02.08.05.04.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Feb 2017 05:04:21 -0800 (PST) To: "caml-list@inria.fr" From: Mohamed Iguernlala Message-ID: <74f3ea0c-a93e-d8ae-6071-14a250baa662@gmail.com> Date: Wed, 8 Feb 2017 14:04:21 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Caml-list] better "encapsulation" for type Digest.t ? Hi, I am wondering why the type t of Digest module is not abstract or defined as private. Currently, this type is an alias of string. Thus, one can easily make a mistake by providing a string instead of a Digest.t to function Digest.to_hex, which raises an exception (ex1 below). The type-checker would help to catch this kind of errors if Digest.t was abstract or private. (* from Digest.mli: type t = string val to_hex : t -> string val string : string -> t *) let ex1 = try ignore (Digest.to_hex "foobar") with Invalid_argument("index out of bounds") -> Format.eprintf "Aie !@." let ex2 = ignore (Digest.to_hex (Digest.string "foobar")); - Mohamed. -- Senior R&D Engineer, OCamlPro SAS Research Associate, VALS team, LRI Webpage: http://www.iguer.info LinkedIn: https://fr.linkedin.com/in/mohamed-iguernlala-71515979