From: Vincent Aravantinos <vincent.aravantinos@yahoo.fr>
To: Brian Hurt <bhurt@spnz.org>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Stupid question re:modules
Date: Fri, 24 Aug 2007 12:16:55 +0200 [thread overview]
Message-ID: <E9FDAB1A-3717-4C84-A748-6D042B0AE9EC@yahoo.fr> (raw)
In-Reply-To: <Pine.LNX.4.64.0708232023160.12703@localhost>
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
next prev parent reply other threads:[~2007-08-24 10:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-24 0:32 Brian Hurt
2007-08-24 2:56 ` [Caml-list] " Jacques Garrigue
2007-08-24 4:31 ` Julien Moutinho
2007-08-24 10:16 ` Vincent Aravantinos [this message]
2007-09-23 9:37 ` David Teller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E9FDAB1A-3717-4C84-A748-6D042B0AE9EC@yahoo.fr \
--to=vincent.aravantinos@yahoo.fr \
--cc=bhurt@spnz.org \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox