Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* inheritance for functor ?
@ 1998-08-26  8:27 Christophe Raffalli
  1998-09-04  5:53 ` David Monniaux
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe Raffalli @ 1998-08-26  8:27 UTC (permalink / raw)
  To: caml-list

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1998-09-04 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-08-26  8:27 inheritance for functor ? Christophe Raffalli
1998-09-04  5:53 ` David Monniaux
1998-09-04 13:36   ` Jerome Vouillon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox