[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Christophe Raffalli <Christophe.Raffalli@u...> |
| Subject: | inheritance for functor ? |
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