Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Nicolas FRANCOIS (AKA El Bofo) <nicolas.francois@free.fr>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Objects or modules ?
Date: Sat, 29 Jun 2002 03:14:58 +0200	[thread overview]
Message-ID: <20020629031458.4d0c7fe9.nicolas.francois@free.fr> (raw)

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


             reply	other threads:[~2002-06-29  1:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-29  1:14 Nicolas FRANCOIS [this message]
2002-06-29  6:47 ` Chris Hecker
2002-06-30  6:44   ` Blair Zajac
2002-06-29 10:22 ` Markus Mottl
2002-07-03 23:16   ` Nicolas FRANCOIS
2002-07-05  0:02     ` Nicolas FRANCOIS
2002-07-01  1:19 ` Nicolas FRANCOIS
2002-07-02 17:24 ` Francois Pottier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020629031458.4d0c7fe9.nicolas.francois@free.fr \
    --to=nicolas.francois@free.fr \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox