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 KAA06150 for caml-redistribution; Thu, 10 Apr 1997 10:51:01 +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 MAA16467 for ; Wed, 9 Apr 1997 12:05:10 +0200 (MET DST) Received: from arthur.u-strasbg.fr (boos@arthur.u-strasbg.fr [130.79.6.103]) by nez-perce.inria.fr (8.7.6/8.7.3) with ESMTP id MAA00288 for ; Wed, 9 Apr 1997 12:05:08 +0200 (MET DST) Received: (from boos@localhost) by arthur.u-strasbg.fr (8.7.5/8.7.3) id MAA28159; Wed, 9 Apr 1997 12:01:17 +0200 Date: Wed, 9 Apr 1997 12:01:17 +0200 Message-Id: <199704091001.MAA28159@arthur.u-strasbg.fr> From: Christian Boos MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: caml-list@inria.fr Subject: Q: about type inclusion X-Mailer: VM 6.22 under 19.15 XEmacs Lucid Sender: weis [Summary: it seems that module type inclusion doesn't use the notion of class subtyping. Is there a theoretical reason for that or could it be done in the future ?] Hello, I was at first puzzled by an error message saying "type x is not included in type y", because type x was a class inherited from class y, until I realized that there is two distinct notions of type inclusion in the langage : module type inclusion and class subtyping. However, I don't see why they couldn't mix, in particular on the example given at the end of this message. Any comments welcomed ! ------------------------------------------------------------------ [Resume: il semblerait que l'inclusion entre types de modules n'exploite pas les relations de sous-typage entre classes. Y a-t-il une impossibilite quelque part ou bien est-ce realisable ?] Bonjour, Bien que presentant de nombreuses similitudes, l'inclusion entre types de modules et le sous-typage entre classes sont deux choses distinctes dans le langage. Cependant je n'entrevois pas les raisons d'une incompatibilite de fond entre les deux, notamment celle conduisant a produire une erreur sur l'exemple ci-apres. ------------------------------------------------------------------ module type A = sig class a (unit) = method a : int end end module type B = sig class a (unit) = method a : int method b : int end end module Bimpl = struct class a () = method a = 1 method b = 2 end end module B = (Bimpl : B) (* of course *) (* but *) module A = (Bimpl : A) Characters 16-21: Signature mismatch: Modules do not match: sig class a (unit) = method a : int method b : int end end is not included in A Class types do not match: class a (unit) = method a : int method b : int end is not included in class a (unit) = method a : int end # -- Christian