From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id DAA12250; Wed, 7 Jul 2004 03:53:24 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA12188 for ; Wed, 7 Jul 2004 03:53:23 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i671rKSH000830 for ; Wed, 7 Jul 2004 03:53:21 +0200 Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3p2-20030924/3.7W) with ESMTP id KAA08174; Wed, 7 Jul 2004 10:53:16 +0900 (JST) Date: Wed, 07 Jul 2004 10:53:16 +0900 (JST) Message-Id: <20040707.105316.68550622.garrigue@kurims.kyoto-u.ac.jp> To: szegedy@t-online.de Cc: caml-list@inria.fr Subject: Re: [Caml-list] Polymorphic method problem From: Jacques GARRIGUE In-Reply-To: <40EAEE20.2010805@t-online.de> References: <40EAEE20.2010805@t-online.de> X-Mailer: Mew version 4.0.64 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 40EB5790.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 jacques:01 bug:01 subtyping:01 jacques:01 workaround:01 garrigue:01 garrigue:01 polymorphic:01 compile:02 unit:03 unit:03 algorithm:03 object:03 object:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: szegedy@t-online.de (Christian Szegedy) > Can anyone tell me, why does the following piece of > code fail to compile, and how can I achieve > equivalent effect in the most convenient way? > > class a () = > object(self) > method f : 'a. ((< f : unit; .. > as 'a) -> unit) = fun other -> > other#f > method g = (self :> a) > end There was a bug in the subtyping algorithm. Hopefully, it's now fixed in CVS. A workaround at the source level is to define your type in advance: class type ta = object method f : -> unit method g : ta end class a () = object(self : #ta) method f other = other#f method g = (self :> ta) end Jacques Garrigue ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners