From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA21442 for caml-redistribution; Tue, 31 Aug 1999 14:15:30 +0200 (MET DST) 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 UAA06983 for ; Mon, 30 Aug 1999 20:56:07 +0200 (MET DST) Received: from uni-sb.de (uni-sb.de [134.96.252.33]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA04224 for ; Mon, 30 Aug 1999 20:56:04 +0200 (MET DST) Received: from cs.uni-sb.de (cs.uni-sb.de [134.96.252.31]) by uni-sb.de (8.9.3/1999070600) with ESMTP id TAA08854 for ; Mon, 30 Aug 1999 19:09:44 +0200 (CEST) Received: from grizzly.ps.uni-sb.de (grizzly.ps.uni-sb.de [134.96.186.68]) by cs.uni-sb.de (8.9.3/1999031900) with ESMTP id TAA14577 for ; Mon, 30 Aug 1999 19:09:44 +0200 (CEST) Received: (from root@localhost) by grizzly.ps.uni-sb.de (8.9.1a/8.9.1) id TAA13909 for caml-list@inria.fr; Mon, 30 Aug 1999 19:09:44 +0200 To: caml-list@inria.fr From: Gert Smolka Subject: Overriding with subtypes Date: Mon, 30 Aug 1999 18:54:30 +0200 Organization: UdS Message-ID: <37CAB746.950F452C@ps.uni-sb.de> Sender: weis It should be ok to override a method of type t with a method of a subtype of t. In fact, that happens in class c = object(self) method a = self end class c' = object(self) inherit c method a = self method b = 1 end since c' is a proper subtype of c. This is accepted by Ocaml. However, class d = object method a = new c end class d' = object inherit d method a = new c' end is rejected. Why? I would expect that this is a limitation that is due to the type inferencer. Gert Smolka