From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id SAA25048 for caml-redistribution; Mon, 25 May 1998 18:36:51 +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 NAA29266 for ; Mon, 25 May 1998 13:46:14 +0200 (MET DST) Received: from tcs.inf.tu-dresden.de (tcs.inf.tu-dresden.de [141.76.75.119]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id NAA21615 for ; Mon, 25 May 1998 13:46:12 +0200 (MET DST) Received: from ithif18.inf.tu-dresden.de (ithif18 [141.76.75.118]) by tcs.inf.tu-dresden.de (8.8.3/8.8.3) with SMTP id NAA11282 for ; Mon, 25 May 1998 13:45:37 +0200 (MET DST) Received: by ithif18.inf.tu-dresden.de (SMI-8.6/SMI-SVR4) id NAA21664; Mon, 25 May 1998 13:46:19 +0200 Date: Mon, 25 May 1998 13:46:19 +0200 Message-Id: <199805251146.NAA21664@ithif18.inf.tu-dresden.de> From: Hendrik Tews MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr Subject: co(ntra)-variant subtyping In-Reply-To: <19980522112157L.garrigue@kurims.kyoto-u.ac.jp> References: <199805201500.RAA19129@ithif18.inf.tu-dresden.de> <19980522112157L.garrigue@kurims.kyoto-u.ac.jp> X-Mailer: VM 6.34 under Emacs 19.34.1 Sender: weis Hi, Objective Caml's subtyping algorithm does not subtype under type constructors (but it does it under abbreviations), for the sake of efficiency. That is, eventhough colored_point :> point, you don't have colored_point option :> point option. This equation would be needed to check the subtyping in method move of example 2. I must say I am really surprised. How about object types? Do they support co(ntra)-variant subtype rules? I would suggest to include a section about the subtype relation in the ocaml documentation. Because IMHO anybody how knows something about formal models for oo languages would expect co(ntra)-variant subtype rules. In summary I think the lack of these subtype rules are a major restriction of the ocaml language. Now it is not possible to mix class types and (algebraic) data types in an application. Instead a user has to decide beforehand what is more important for him: algebraic data types and parametric polymorphism or object types with code reuse and stepwise refinement. Are there any plans to add the missing subtype rules to the type system of ocaml? Bye, Hendrik