From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA17752 for caml-redistribution; Thu, 20 Aug 1998 01:41:53 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA32254 for ; Wed, 19 Aug 1998 10:32:48 +0200 (MET DST) Received: from isis.e-i.net (isis.e-i.net [193.57.116.130]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id KAA02915 for ; Wed, 19 Aug 1998 10:32:45 +0200 (MET DST) Received: from e-i.com by isis.e-i.net (8.8.5/SMI-SVR4) id IAA45248; Wed, 19 Aug 1998 08:32:31 GMT Message-ID: <35DA8DDB.4BBB1E59@e-i.com> Date: Wed, 19 Aug 1998 10:33:31 +0200 From: Sven LUTHER Reply-To: luther@dpt-info.u-strasbg.fr, LUTHERSV@e-i.com X-Mailer: Mozilla 4.5b1 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: caml-list@inria.fr Subject: Types construits et interface de modules Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: weis Bonjour, ... Hello, ... est -il possible de faire la chose suivante en caml ? is it possible to do something like that in caml ? module type T = sig type t = A | B end module A = struct type t = A | B end module B = struct type t = A | B | C end module F (M:T) = struct type t = M.t end module MA = F (A) module MB = F (B) cela ne marche pas car les types t = A | B et t = A | B | C sont differents this don't work because the types t = A | B and t = A | B | C are different cependant il est possible de faire : module type T = sig type t val a : t val b : t end module A = struct type t = A | B let a = A let b = B end module B = struct type t = A | B | C let a = A let b = B let c = C end module F (M:T) = struct type t = M.t let a = M.a let b = M.b end module MA = F (A) module MB = F (B) en, quoi les constructeurs de types sont-ils differents des fonctions ? Ils ne sont pas propres a chaque type (en effet dans type t = A | B type t' = A | C, t'.A ecrase t.A). Il serait interressant de pouvoir definir automatiquement les constructeurs dans l'interface du module. in what are the type constuctors different from function symbols ? they don't belong only to the corresponding type, but to the whole module. it would be nice to be able to define also the type constructors in the interface of a module. module A = struct type t = A |B end aurrais le type : would have the following type : sig type t val A : t val B : t end Est ce que cela pose des probleme grave, ou ne s'agit-il que de sucre syntaxique autour de l'implementation actuelle ? Would this bring serious problems, or is it just syntaxic sugar over the actual state of things ? Amicalement, Sven LUTHER