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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 18D56BC85 for ; Fri, 17 Mar 2006 09:17:21 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k2GMO4OB025787 for ; Thu, 16 Mar 2006 23:24:04 +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 XAA10435 for ; Thu, 16 Mar 2006 23:24:03 +0100 (MET) Received: from grymling.conjury.org (grymling.conjury.org [69.12.155.90]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k2GMO2DB010263 for ; Thu, 16 Mar 2006 23:24:02 +0100 Received: from localhost (localhost [127.0.0.1]) by grymling.conjury.org (Postfix) with ESMTP id 7D608A2406 for ; Thu, 16 Mar 2006 14:24:01 -0800 (PST) Received: from grymling.conjury.org ([127.0.0.1]) by localhost (grymling.conjury.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15862-08 for ; Thu, 16 Mar 2006 14:23:54 -0800 (PST) Received: from [10.0.1.200] (station.conjury.org [69.12.155.91]) by grymling.conjury.org (Postfix) with ESMTP id 57AA4A23E7 for ; Thu, 16 Mar 2006 14:23:54 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v746.3) Content-Transfer-Encoding: quoted-printable Message-Id: Content-Type: text/plain; charset=WINDOWS-1252; delsp=yes; format=flowed To: The Caml Trade From: j h woodyatt Subject: spurious warning? "polymorphic method not principal" Date: Thu, 16 Mar 2006 14:23:49 -0800 X-Mailer: Apple Mail (2.746.3) X-Virus-Scanned: by amavisd-new at conjury.org X-Miltered: at concorde with ID 4419E584.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4419E582.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; woodyatt:01 jhw:01 everyone--:01 'self:01 printf:01 printf:01 val:01 initialized:01 initialized:01 ocamlc:01 -principal:01 confuses:01 bug:01 bug:01 compiler: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 everyone-- Please, consider the following test case: > (* test.ml *) > class alfa =3D object(_:'self) > method x: 'a. ('a, out_channel, unit) format -> 'a =3D Printf.printf > end > > class bravo a =3D object > val y: alfa =3D (a :> alfa) > initializer y#x "bravo initialized" > end > > class charlie a =3D object > inherit bravo a > initializer y#x "charlie initialized" > end $ ocamlc -principal -o test test.ml File "test.ml", line 13, characters 14-17: Warning X: this use of a polymorphic method is not principal. It warns about the use of the polymorphic method on the object in the =20= membership of the base class, but only when it's invoked from the =20 derived class. This confuses me. Is this a bug in my code? =20 (Perhaps, the word "principal" in this context doesn't mean what I =20 think it means.) Or is it a bug in the compiler? If it isn't a bug in the compiler, =20 could someone please explain to me why my program produced this =20 warning? Thank you very much. =97 j h woodyatt