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 DAA31139; Sat, 29 Jun 2002 03:06:48 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 DAA31352 for ; Sat, 29 Jun 2002 03:06:47 +0200 (MET DST) Received: from postfix2-1.free.fr (postfix2-1.free.fr [213.228.0.9]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g5T16k524982 for ; Sat, 29 Jun 2002 03:06:46 +0200 (MET DST) Received: from lfs (strasbourg-1-a7-62-147-9-65.dial.proxad.net [62.147.9.65]) by postfix2-1.free.fr (Postfix) with SMTP id A3D873F5 for ; Sat, 29 Jun 2002 03:06:45 +0200 (CEST) Date: Sat, 29 Jun 2002 03:14:58 +0200 From: Nicolas FRANCOIS (AKA El Bofo) To: Caml List Subject: [Caml-list] Objects or modules ? Message-Id: <20020629031458.4d0c7fe9.nicolas.francois@free.fr> X-Mailer: Sylpheed version 0.7.6 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I'd like to make a library managing mathematical data structures, for example integers, polynoms, fractions, and more if anyone is interested. I started on the module point of view, mainly to learn how to use modules and functors. So this is the structure I have : Ordered_Ring : module managing basic rings operations Rationnals : Num rationnals adapted to Ordered_Ring Polynoms : functor taking an ordered ring S in argument to make a module managing S[x] Q_polynoms : polynoms over rationnals. But I see things differently now, mainly because I realized S[x] is an euclidian ring just as S is, so they should inherit the same module, and have common operations ((extended) Euclide, square_free factorization...). in fact I realized this when I started writing my second gcd function. So my point of view is now : Euclidian_Ring : Functor taking a ring signature (data structure, basic operation + and *, link with Z and Q...), and constructing an euclidian ring with tools. Rationnals : Euclidian_Ring(Sig_Num) Sig_Pol : Functor constructing an abstract polynom module sig Polynom : functor constructing a ring S[x] provided a ring S Do you think this plan is correct ? Should I translate it to objects ? Is there some drawbacks using modules or objects ? Thanks for reading. \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