From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id E79F2BB81 for ; Thu, 8 Dec 2005 04:10:38 +0100 (CET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jB83Aafu031427 for ; Thu, 8 Dec 2005 04:10:38 +0100 Received: from localhost (suiren [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.13.1/8.13.1) with ESMTP id jB83AHcx013748; Thu, 8 Dec 2005 12:10:17 +0900 (JST) Date: Thu, 08 Dec 2005 12:10:12 +0900 (JST) Message-Id: <20051208.121012.49167263.garrigue@math.nagoya-u.ac.jp> To: skaller@users.sourceforge.net Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] partial application warning unreliable? From: Jacques Garrigue In-Reply-To: <1134009551.10435.24.camel@rosella> References: <1134009551.10435.24.camel@rosella> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4397A42C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 srcref:01 token:01 srcref:01 bug:01 semicolon:01 trailing:01 semicolon:01 bug:01 sourceforge:01 polymorphic:01 partial:01 partial:01 behaviour:01 functions:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 From: skaller > method add_nonterminal (s:string) (sr:range_srcref) (toks: > Flx_parse.token list) (term:ast_term_t) = > > ... > state#add_nonterminal tok (Flx_srcref.slift sr) t; > > Method has 4 arguments, but the call applies to only 3. > > Woops, no warning!! Bad! This error of mine caused a serious > bug -- the method call didn't do anything! Wait a minute, is there anything after the semicolon? The point is that a trailing semicolon at the end of a method definition does nothing: it still returns the result of the previous expression! I wonder whether this behaviour is good or not, but this also means that there is no reason to have a warning here. If there is an expression after the semicolon, and you have no warning, then file a bug report: the type system is supposed to detect all partial applications in statements, except for functions whose result is a polymorphic type variable. By the way, your other example with classes is wrong: # class cc = object (self) method f x y = x + y method g () = self#f 1; end;; class cc : object method f : int -> int -> int method g : unit -> int -> int end No warning, for the reason stated above: the semicolon does nothing. Jacques Garrigue