caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Q: about type inclusion
@ 1997-04-09 10:01 Christian Boos
  1997-04-18 13:34 ` Jerome Vouillon
  0 siblings, 1 reply; 3+ messages in thread
From: Christian Boos @ 1997-04-09 10:01 UTC (permalink / raw)
  To: caml-list


[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 





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1997-06-23 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-04-09 10:01 Q: about type inclusion Christian Boos
1997-04-18 13:34 ` Jerome Vouillon
1997-06-23  9:46   ` Functors & Classes (was Re: Q: about type inclusion) Christian Boos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).