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 LAA07466; Tue, 16 Jul 2002 11:51:19 +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 LAA07547 for ; Tue, 16 Jul 2002 11:51:18 +0200 (MET DST) Received: from postfix2-2.free.fr (postfix2-2.free.fr [213.228.0.140]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6G9pHT10374 for ; Tue, 16 Jul 2002 11:51:17 +0200 (MET DST) Received: from lfs (strasbourg-4-a7-62-147-196-222.dial.proxad.net [62.147.196.222]) by postfix2-2.free.fr (Postfix) with SMTP id D86845F9FC for ; Tue, 16 Jul 2002 11:51:15 +0200 (CEST) Date: Tue, 16 Jul 2002 11:59:19 +0200 From: Nicolas FRANCOIS (AKA El Bofo) To: caml-list@inria.fr Subject: Re: [Caml-list] About modules again Message-Id: <20020716115919.6eab0e68.nicolas.francois@free.fr> In-Reply-To: <20020715084435.GA31562@fichte.ai.univie.ac.at> References: <20020715023542.56e961fa.nicolas.francois@free.fr> <20020715084435.GA31562@fichte.ai.univie.ac.at> X-Mailer: Sylpheed version 0.7.6 (GTK+ 1.2.10; i686-pc-linux-gnu) 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 Le Mon, 15 Jul 2002 10:44:35 +0200 Markus Mottl a écrit : > This is the point where higher-order modules (functors) enter the game. > If you have some common functionality that is shared across all rings, > you can factor it out in a functor body. E.g.: > > module MakeRing (Spec : RING_SPEC) : RING = struct > include Spec > > (* All common stuff follows here *) > end > > Module "Spec" should adhere to a signature "RING_SPEC", the latter > specifying what is different or at least parameterizable for each > ring. Applying the functor to such a specification yields a module that > implements the signature RING, e.g.: > > module Ring_Z = MakeRing (Ring_Z_Spec) > > The specification of rings over Z (Ring_Z_Spec) may itself be the result > of a functor application. This way you can highly modularize the > creation of algebraic structures. I see your point. Conway does something like this in his math packages. I'll try to adapt the technique. Thanks Markus. \bye -- Nicolas FRANCOIS http://nicolas.francois.free.fr A TRUE Klingon programmer does NOT comment his code ------------------- 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