From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 97FFCBB81 for ; Fri, 17 Dec 2004 16:00:58 +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 iBHF0wA3005829 for ; Fri, 17 Dec 2004 16:00:58 +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 QAA29651 for ; Fri, 17 Dec 2004 16:00:57 +0100 (MET) Received: from mail.kaba.or.jp (cascade.kaba.or.jp [202.249.19.34]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id iBHF0tLk005815 for ; Fri, 17 Dec 2004 16:00:56 +0100 Received: from localhost (klingon.kaba.or.jp [202.249.19.14]) by mail.kaba.or.jp (Postfix) with ESMTP id AE0D749A6D; Sat, 18 Dec 2004 00:00:51 +0900 (JST) Date: Sat, 18 Dec 2004 00:00:51 +0900 (JST) Message-Id: <20041218.000051.74664732.keiko@kaba.or.jp> To: caml-list@inria.fr Cc: keiko@kaba.or.jp Subject: class subtyping From: nakata keiko X-Mailer: Mew version 3.3 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 concorde with ID 41C2F4AA.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 41C2F4A7.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; subtyping:01 kaba:01 subtyping:01 coerced:01 expr:01 ocaml:01 compiler:01 inherit:01 remy:02 types:02 let:03 problem:05 inria:05 classes:06 extension:06 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: I have a question about subtyping between classes. Why an instance of class a can not coerced into type b? class a = object (self : 'a) method f (x : 'a) = x#g method g = 0 end class b = object inherit a method h = 1 end let x = ((new b) :> a) I got an error for the last statement. I am reading the work on extension problem found at http://pauillac.inria.fr/~remy/work/expr/ then, I am curious to know how ocaml compiler judges subtyping relation involving self types. Regards, Keiko NAKATA.