From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 E2C097EE80 for ; Fri, 22 Mar 2013 10:40:26 +0100 (CET) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.47 as permitted sender) identity=mailfrom; client-ip=209.85.214.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; 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@mail-bk0-f47.google.com) identity=helo; client-ip=209.85.214.47; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkADALMmTFHRVdYviGdsb2JhbABDs0KSNYFWCBYOAQEBCgkUFAQkgiQBAQUnGQEbEgsBAwwGBQsNDSEiAREBBQEKEgYTEodvAQMPDKNljDKCe4Q3ChknAwpZiGsRAQUMjwYHg0ADlmSBH44CFimELjs X-IPAS-Result: AkADALMmTFHRVdYviGdsb2JhbABDs0KSNYFWCBYOAQEBCgkUFAQkgiQBAQUnGQEbEgsBAwwGBQsNDSEiAREBBQEKEgYTEodvAQMPDKNljDKCe4Q3ChknAwpZiGsRAQUMjwYHg0ADlmSBH44CFimELjs X-IronPort-AV: E=Sophos;i="4.84,891,1355094000"; d="scan'208";a="8801391" Received: from mail-bk0-f47.google.com ([209.85.214.47]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 22 Mar 2013 10:40:11 +0100 Received: by mail-bk0-f47.google.com with SMTP id jc3so1757770bkc.20 for ; Fri, 22 Mar 2013 02:40:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=iBRhAadU6dOO8NYe1vQoz8DMEarcd2w07Tgad1g5UWs=; b=IDxwp4cUs8SK3eWhwGNfkAS+Dt9WFRmLFRbgB7jX+OH9G5pM2J7wjdFQ5j9i+a8HsF Ui+OXfh6WcG6hvcp+OnQHgIuLWDNCbWpyMlvOac66ZloKU82epnrda1FzXISP+thbPz5 xar1uK4qrff77t0PI0nSwK3/tfBjNhrIparxxGKXh24lJCn0kPrj2kW0VVmkF/0YdUGB V2ZPnU+ngAflvuPlD106Fa0xNUzG4hOIkAE13CfV6o95VpZzkQBPVqiNPj5X3+f+XNTR atCxG0JIv1G1B1AprzGu0sbPi7tDgbixeyX0ubYd+Uojz1RYri4lRh63hIRVk4w03h1a M+dQ== X-Received: by 10.205.33.81 with SMTP id sn17mr515997bkb.53.1363945210617; Fri, 22 Mar 2013 02:40:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.205.83.144 with HTTP; Fri, 22 Mar 2013 02:39:30 -0700 (PDT) In-Reply-To: <514C2172.7090609@riken.jp> References: <514C1E1B.9050907@riken.jp> <514C2172.7090609@riken.jp> From: Gabriel Scherer Date: Fri, 22 Mar 2013 10:39:30 +0100 Message-ID: To: Francois Berenger Cc: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Warning 20: Unused function argument My understanding is that the warning is raised when applying an argument to an expression whose type is a polymorphic variable (which will become a function type through type instantiation, but it does come from a syntactic of the form "let exp foo bar"). This can quite commonly happen if you use the following pattern to mark not-yet-implemented functions let func _ = failwith "TODO" ... let foo bar = func bar (1 + bar) Calling a toplevel with option "-w +20": # let test _ = failwith "TODO";; val test : 'a -> 'b = # test (1 + 2) (3 + 4);; Warning 20: this argument will not be used by the function. Exception: Failure "TODO". The warning goes away if you write "test" with the expected number of arguments (let test x y = failwith "TODO"). As of today, this warning will not get raised if you simply add unused arguments to your function declaration (and do pass them at the call site). On Fri, Mar 22, 2013 at 10:16 AM, Francois Berenger wrote: > On 03/22/2013 06:05 PM, Gabriel Scherer wrote: >> >> My own guess (pure speculation) as to why this difference is that >> enabling it by default would have raised too many warnings on existing >> code, in particular breaking code of people sadly using a "all enabled >> warnings are errors" discipline (don't!), while unused let-bound >> variables where much less frequent in existing code. > > > OCaml is not lazy, so that's not very smart if some of my functions > have unused arguments... I have to fix my code. :( > > >> On Fri, Mar 22, 2013 at 10:02 AM, Francois Berenger >> wrote: >>> >>> Hello, >>> >>> I understand it is turned off by default. >>> >>> I am a bit surprised as it is as important >>> to me as an unused variable, which triggers a warning >>> by default. >>> >>> Regards, >>> F. >>> >>> -- >>> Caml-list mailing list. Subscription management and archives: >>> https://sympa.inria.fr/sympa/arc/caml-list >>> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners >>> Bug reports: http://caml.inria.fr/bin/caml-bugs >> >> > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs