Browse thread
Stupid question re:modules
-
Brian Hurt
- Jacques Garrigue
- Julien Moutinho
- Vincent Aravantinos
[
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: | 2007-08-24 (10:16) |
From: | Vincent Aravantinos <vincent.aravantinos@y...> |
Subject: | Re: [Caml-list] Stupid question re:modules |
Le 24 août 07 à 02:32, Brian Hurt a écrit : > > I should just know this. So let's say I have two module types > defined: > > module type Foo = sig > type 'a t > val foo : 'a -> 'a t > end;; > > module type Bar = sig > type 'a t > val bar : 'a -> 'a t > end;; > > Now, I want to define a module that is both a Foo and a Bar without > cutting and pasting the module definitions around. I've been > trying to do: > > module Baz : sig > type 'a baz > include Foo with type 'a t = 'a baz > include Bar with type 'a t = 'a baz > end;; > > but this blows up on the Bar line (multiple definitions of 'a t). > > There is a solution to this, I'm just being stupid and forgetting > what it is. Hints would be appreciated. > > Brian See also : http://caml.inria.fr/pub/ml-archives/caml-list/2006/12/ c7461312202053f2213a9bb33206fcb8.en.html BTW, I thought there was some kind of research about inheritance and modules (heard about "mixin modules"), is there any plan to implement this one day in ocaml ? The lack of real inheritance with modules is a major restriction IMHO... -- Vincent Aravantinos PhD Student - LIG - CAPP Team