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 JAA07012; Wed, 12 Feb 2003 09:29:03 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA06600 for caml-list@pauillac.inria.fr; Wed, 12 Feb 2003 09:29:02 +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 WAA28449 for ; Tue, 11 Feb 2003 22:05:27 +0100 (MET) Received: from postfix4-2.free.fr (postfix4-2.free.fr [213.228.0.176]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h1BL5Qf08179 for ; Tue, 11 Feb 2003 22:05:26 +0100 (MET) Received: from univ-savoie.fr (grenoble-2-a7-62-147-190-22.dial.proxad.net [62.147.190.22]) by postfix4-2.free.fr (Postfix) with ESMTP id 3401AC190 for ; Tue, 11 Feb 2003 22:05:25 +0100 (CET) Message-ID: <3E49B9E1.3060106@univ-savoie.fr> Date: Tue, 11 Feb 2003 22:05:05 -0500 From: Christophe Raffalli User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020826 X-Accept-Language: en-us, en MIME-Version: 1.0 Cc: caml-list@inria.fr Subject: [Caml-list] Pb with type constraints in module References: X-Enigmail-Version: 0.65.2.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig7CBD6B4D3E9FFD6CE9647D6D" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig7CBD6B4D3E9FFD6CE9647D6D Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Is there a good reason to have this in the grammar mod-constraint ::= type [type-parameters] typeconstr = typexpr | module module-path = extended-module-path instead of mod-constraint ::= type typedef | module module-path = extended-module-path Here is an example where this is useful: Lets say you have a nice module type and functor: -- module type Ord = sig type t val compare : t -> t -> int end module F(G:Ord) = struct type t = Empty | Node of G.t * t * t let compare = ... the code you want ... end -- in a .mli you may want to write -- module F : functor (G:Ord) -> Ord with type t = Empty | Node of G.t * t * t -- And this is not legal because "with type" take a typeexpr and not a typedef. This is not very natural, bacause you have to move the definition of t outside F like in -- type 'a tree = Empty | Node of 'a * 'a tree * 'a tree module F(G:Ord) = struct type t = G.t tree let compare = ... the code you want ... end -- in a .mli you can now write -- type 'a tree = Empty | Node of 'a * 'a tree * 'a tree module F : functor (G:Ord) -> Ord with type t = G.t tree -- The same happends if you use recursive type -- module F : functor (G:Ord) -> Ord with type t = (G.t * t) list -- is not legal either. -- Christophe Raffalli Université de Savoie Batiment Le Chablais, bureau 21 73376 Le Bourget-du-Lac Cedex tél: (33) 4 79 75 81 03 fax: (33) 4 79 75 87 42 mail: Christophe.Raffalli@univ-savoie.fr www: http://www.lama.univ-savoie.fr/~RAFFALLI --------------------------------------------- IMPORTANT: this mail is signed using PGP/MIME At least Enigmail/Mozilla, mutt or evolution can check this signature --------------------------------------------- --------------enig7CBD6B4D3E9FFD6CE9647D6D Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE+SbnmSQDyWB/+xBwRAqCUAJ9SH7q5o6GUt+GQEiJ2XvOY+6mzuwCeOpE6 Jjo91kxVEAqofEwHLXQdPPs= =VU+I -----END PGP SIGNATURE----- --------------enig7CBD6B4D3E9FFD6CE9647D6D-- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners