Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
To: caml-list@inria.fr
Subject: inheritance for functor ?
Date: Wed, 26 Aug 1998 10:27:21 +0200	[thread overview]
Message-ID: <35E3C6E9.BAFFE611@univ-savoie.fr> (raw)

The "open" feature for module and module type does not add any
construtor to a module. It would be nice to also have an "inherit" or
"import" constructor that would add all the constructor of a module to
the current module.

Here si an example:

I could write this:

module type Ring =
  sig
   type t                          (*les elemnets de l'anneau seront de
type t*)  
    val zero : t                   (*definition de l'element nul*)
    val one : t                    (*definition de l'unite*)
    val t_of_int : int -> t
    val (++) : t -> t -> t         (*definition de la somme pour
l'anneau*)
    val (--) : t -> t -> t         (*definition de la soustraction*)  
    val ( ** ) : t -> t -> t       (*definition de la multiplication*)
    val (==) : t -> t -> bool
    val opp: t -> t
    val print : t -> unit 

  end

module type Field =
  sig
   import Ring   
    val (//) : t -> t -> t
  end

module type Euclidian_Ring =
  sig
   import Ring
   type nt
    val norm : t -> nt
    val leq : nt -> nt -> bool
    val (//) : t -> t -> t
    val (mod) : t -> t -> t
    val div_mod : t -> t -> t * t
  end

This feature reflects more the intention of the programmer.

 
-- 
Christophe Raffalli
Laboratoire de Mathématique / LAMA
Université de Savoie
UFR SFA, Campus Scientifique
73376, Le Bourget du Lac CEDEX, FRANCE.

URL: http://www.logique.jussieu.fr/www.raffalli
email: Christophe.Raffalli@univ-savoie.fr





             reply	other threads:[~1998-08-29 16:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-08-26  8:27 Christophe Raffalli [this message]
1998-09-04  5:53 ` David Monniaux
1998-09-04 13:36   ` Jerome Vouillon

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=35E3C6E9.BAFFE611@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.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