[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christian Boos <boos@a...> |
| Subject: | Q: about type inclusion |
[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