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 46511BC2F for ; Fri, 26 Nov 2004 15:43:52 +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 iAQEhpls021130 for ; Fri, 26 Nov 2004 15:43:51 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA04593 for ; Fri, 26 Nov 2004 15:43:51 +0100 (MET) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iAQEhnpE027051 for ; Fri, 26 Nov 2004 15:43:50 +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 iAQEgm26010721; Fri, 26 Nov 2004 23:42:48 +0900 (JST) Date: Fri, 26 Nov 2004 23:42:36 +0900 (JST) Message-Id: <20041126.234236.32629560.garrigue@math.nagoya-u.ac.jp> To: warplayer@free.fr Cc: caml-list@inria.fr Subject: Re: [Caml-list] Why doesn't ocamlopt detect a missing ; after failwith statement? From: Jacques Garrigue In-Reply-To: <004201c4d386$cc6fe4a0$19b0e152@warp> References: <1101438486.9291.138.camel@pelican.wigram> <20041126.142525.93385094.garrigue@math.nagoya-u.ac.jp> <004201c4d386$cc6fe4a0$19b0e152@warp> 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 41A74127.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41A74125.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlopt:01 failwith:01 cannasse:01 warplayer:01 failwith:01 forall:01 arity:01 forall:01 polymorphic:01 short:01 dev:01 jacques:01 jacques:01 argument: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: "Nicolas Cannasse" > > P.S. > > I believe the problem with failwith is solvable, albeit rather > > complicated. The idea is that you want to be warned when you apply a > > function of type (\forall 'a. 'a) to something, because no such > > function may exist, so that this application will never actually take > > place. > > > > This could be done attempting to generalize the type of the function, > > once we now it is a type variable. > > I'll have a try. > > Wouldn't that break Obj.magic ? I can't see a clear solution to this > problem, unless enabling arity specification into polymorphic variables : No, because we only look at whether we are applying a function of type (\forall 'a. 'a), while Obj.magic is of type (\forall 'a 'b. 'a -> 'b) I've tried, and this seems to work. Actually the code is pretty short. Objective Caml version 3.09+dev8 (2004-11-24) # raise Exit 3;; ^ Warning X: this argument is passed to a never returning function. There is indeed a problem with Obj.magic, but it concerns uses of the form (Obj.magic f x), which are rather dangerous. Still, this is used quite a bit in the distribution, and for this reason I disabled the warning in applications of Obj.magic. Eventhough, the changes are not so small, so the commit will have to wait a bit. Jacques Garrigue