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 0F5407EE34 for ; Fri, 18 Mar 2016 23:06:53 +0100 (CET) IronPort-PHdr: 9a23:sJQaDBaBYKydHheRUfjn1lb/LSx+4OfEezUN459isYplN5qZpci/bnLW6fgltlLVR4KTs6sC0LqG9fi+EjJcqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7D0o8OYPVkArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Kq8xSLgdCDU9L0g04tfqvF/NV1ih/HwZB0MXmR1MChONxhjgWJb8qGOuvONn3iiXJ+XsQLs0VC6p76otRRnhg2EJLWhqoynslsVsgfcD81qarBtlztuMbQ== Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=barnier@recherche.enac.fr; spf=None smtp.mailfrom=barnier@recherche.enac.fr; spf=None smtp.helo=postmaster@smtp2-g21.free.fr Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of barnier@recherche.enac.fr) identity=pra; client-ip=212.27.42.2; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="barnier@recherche.enac.fr"; x-sender="barnier@recherche.enac.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of barnier@recherche.enac.fr) identity=mailfrom; client-ip=212.27.42.2; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="barnier@recherche.enac.fr"; x-sender="barnier@recherche.enac.fr"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@smtp2-g21.free.fr) identity=helo; client-ip=212.27.42.2; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="barnier@recherche.enac.fr"; x-sender="postmaster@smtp2-g21.free.fr"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CkAQCveuxWkwIqG9RevzWBb4YNAoExOhIBAQEBAQEBARABAQEBBw0JCSEvQRIBgVmCFQEBBCMECwEFQBELGgIFFgsCAgkDAgECAUUTCAEBiCexMY9EDAEdfIlmhDpOgjSCVgWXV5c3hVSPBicBgk6BUoQ8hxABAQE X-IPAS-Result: A0CkAQCveuxWkwIqG9RevzWBb4YNAoExOhIBAQEBAQEBARABAQEBBw0JCSEvQRIBgVmCFQEBBCMECwEFQBELGgIFFgsCAgkDAgECAUUTCAEBiCexMY9EDAEdfIlmhDpOgjSCVgWXV5c3hVSPBicBgk6BUoQ8hxABAQE X-IronPort-AV: E=Sophos;i="5.24,357,1454972400"; d="scan'208";a="169488571" Received: from smtp2-g21.free.fr ([212.27.42.2]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/ADH-AES256-GCM-SHA384; 18 Mar 2016 23:06:51 +0100 Received: from [192.168.1.106] (unknown [82.238.146.34]) by smtp2-g21.free.fr (Postfix) with ESMTP id 2B92B4B01AB for ; Fri, 18 Mar 2016 23:02:32 +0100 (CET) To: caml-list@inria.fr References: <56EC4318.2020701@freenet.de> <56EC4E7F.8060602@tu-berlin.de> From: Nicolas Barnier Message-ID: <56EC7BFB.4070200@recherche.enac.fr> Date: Fri, 18 Mar 2016 23:06:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <56EC4E7F.8060602@tu-berlin.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Caml-list] what does let () = ... define? Le 18/03/2016 19:52, Christoph Höger a écrit : > It defines a match-expression with a single case, that is why you get > the warning on None. [...] > The same holds > for records, tuples etc. think of it as a shallow and cheap type annotation. Indeed. And it is quite a common idiom to write the equivalent of a "main" function at the end of a source file as the last called function of your program shouldn't return any useful value, for example : let () = let x = int_of_string Sys.argv.(1) in solve x It's better practice than to write : let _ = ... because it can catch some type error that would silently pass with the latter: suppose you finally decide to add a parameter to the solve function (let solve = fun x y -> ...), if you forget to add the argument to the call to solve in the main function, in the first case you get a type error, but your program compiles and just does nothing in the second case (_ matches with a partial application of solve). Regards, -- Nicolas