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 XAA22854; Wed, 13 Oct 2004 23:51:50 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 XAA22596 for ; Wed, 13 Oct 2004 23:51:49 +0200 (MET DST) Received: from herd.plethora.net (herd.plethora.net [205.166.146.1]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id i9DLpl51020697 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 13 Oct 2004 23:51:49 +0200 Received: from bhurt.plethora.net (bhurt.plethora.net [205.166.146.49]) by herd.plethora.net (8.13.1/8.12.11) with ESMTP id i9DLpg1Q022659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Oct 2004 16:51:45 -0500 (CDT) Date: Wed, 13 Oct 2004 17:00:12 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: Ocaml Mailing List Subject: [Caml-list] My wishlist: DRY modules Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at nez-perce with ID 416DA373.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; wishlist:01 annoyances:01 foo:01 foo:01 mli:01 val:01 val:01 struct:01 mli:01 pragmatic:01 sig:01 sig:01 signatures:02 signatures:02 modules:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'm doing some work with modules, and I'm learning some of their annoyances. Number one is having to repeat module type definitions. For example, say you have a file foo. In foo.mli, you have: module type T = sig type s val needed : ... end module type S = sig type t val doit : ... val orelse : ... end module Make(Arg: T) : S with type t = Arg.s So far, so good, but now in foo.ml you need to replicate the definitions of *both* T and S: module type T = sig type s val needed : ... end module type S = sig type t val doit : ... val orelse : ... end module Make(Arg: T) = struct type t = Arg.s let doit = ... let orelse = ... end Now, if you know your module signatures when you start, this isn't that big of a problem- it's a cut and paste. Unfortunately, if you don't know your module signatures at the begining, to add or subtract or change a type or val you need to update the signature in *three* different places. I wish you didn't have to repeat the module definitions in the module file *if* you have a .mli file. The subject line, BTW, comes from the Pragmatic Programmer book's DRY principle- Don't Repeat Yourself. -- "Usenet is like a herd of performing elephants with diarrhea -- massive, difficult to redirect, awe-inspiring, entertaining, and a source of mind-boggling amounts of excrement when you least expect it." - Gene Spafford Brian ------------------- 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