From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 8E73DBC2F for ; Fri, 26 Nov 2004 01:44:44 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id iAQ0iifE023774 for ; Fri, 26 Nov 2004 01:44:44 +0100 Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA04584 for ; Fri, 26 Nov 2004 01:44:42 +0100 (MET) 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 iAQ0ie3D023764 for ; Fri, 26 Nov 2004 01:44:41 +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 iAQ0iNe9022970; Fri, 26 Nov 2004 09:44:24 +0900 (JST) Date: Fri, 26 Nov 2004 09:44:12 +0900 (JST) Message-Id: <20041126.094412.30442729.garrigue@math.nagoya-u.ac.jp> To: skaller@users.sourceforge.net Cc: warplayer@free.fr, caml-list@inria.fr Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? From: Jacques Garrigue In-Reply-To: <1101427906.9291.107.camel@pelican.wigram> References: <20041125204628.GA24215@annexia.org> <005701c4d333$c3bc31e0$19b0e152@warp> <1101427906.9291.107.camel@pelican.wigram> X-Mailer: Mew version 4.0.64 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 41A67C7C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 41A67C78.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlopt:01 failwith:01 sourceforge:01 cannasse:01 wrote:01 val:01 failwith:01 prerr:01 endline:01 unify:01 unify:01 prerr:01 endline:01 unification:01 X-Spam-Checker-Version: SpamAssassin 3.0.0 (2004-09-13) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.0 X-Spam-Level: From: skaller > On Fri, 2004-11-26 at 08:14, Nicolas Cannasse wrote: > > > All well and good, but I don't understand why it doesn't warn me about > > > the missing ';' in the first case. > > > > val failwith : string -> 'a > > > > so failwith "error" prerr_endline "OK"; > > > > is a valid call since 'a unify with (string -> unit) -> string -> unit > > .. a problem which could not occur were there a void type > which couldn't unify with 'a, and prerr_endline had > type string-> void. But by definition 'a unifies with everything, including your void type, or you get a noncommutative notion of unification... The real problem here is the type of failwith, which is not informative enough. Or to be more precise, it is informative enough, but for this you must realize that 'a occurs only once, and so that any further application is meaningless. The type checker is not that clever (not good at detecting lone occurences.) Jacques Garrigue