From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA21350; Thu, 31 Jan 2002 11:04:01 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA21486 for ; Thu, 31 Jan 2002 11:04:00 +0100 (MET) Received: from nef.ens.fr (nef.ens.fr [129.199.96.32]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g0VA40D27961 for ; Thu, 31 Jan 2002 11:04:00 +0100 (MET) Received: from dmi.ens.fr (dmi.ens.fr [129.199.96.11]) by nef.ens.fr (8.10.1/1.01.28121999) with ESMTP id g0VA3xl21358 for ; Thu, 31 Jan 2002 11:03:59 +0100 (CET) Received: from basilic.ens.fr (monniaux@basilic [129.199.99.48]) by dmi.ens.fr (8.10.1/jb-1.3-180200) id g0VA3xp22840 for ; Thu, 31 Jan 2002 11:03:59 +0100 (MET) Received: from localhost (monniaux@localhost) by basilic.ens.fr (8.11.0/jb-1.1) id g0VA3vS17002 for ; Thu, 31 Jan 2002 11:03:57 +0100 (MET) X-Authentication-Warning: basilic.ens.fr: monniaux owned process doing -bs Date: Thu, 31 Jan 2002 11:03:57 +0100 (MET) From: David Monniaux X-Sender: monniaux@basilic.ens.fr To: Liste CAML Subject: [Caml-list] multiple includes in module types with shared types Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, It seems quite logical to have constructs such as: module type ORDERED_TYPE = sig type t val compare: t->t->int end module type PRINTABLE_TYPE = sig type t val print: Format.formatter->t->unit end Now we want to define such things as module type ORDERED_PRINTABLE_TYPE = sig include ORDERED_TYPE include PRINTABLE_TYPE end but this is refused since it defines "t" twice. module type ORDERED_PRINTABLE_TYPE = sig include ORDERED_TYPE include PRINTABLE_TYPE with type t = t end is also refused. Is there a workaround, short of manually including one of the modules without the type t? Alain Frisch suggested module type ORDERED_TYPE = sig type t val compare: t->t->int end;; module type PRINTABLE_TYPE = sig type s val print: Format.formatter->s->unit end;; module type ORDERED_PRINTABLE_TYPE = sig include ORDERED_TYPE include PRINTABLE_TYPE with type s = t end but this is very inelegant and has issues of its own. David Monniaux http://www.di.ens.fr/~monniaux Laboratoire d'informatique de l'École Normale Supérieure, Paris, France ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr