From: "Francisco J. Valverde Albacete" <fva@ing.uc3m.es>
To: caml-list@inria.fr
Subject: Piece composition of signatures (& problems derived from them too!)
Date: Tue, 17 Dec 1996 12:58:02 -0800 [thread overview]
Message-ID: <32B7095A.99A@ing.uc3m.es> (raw)
Salut, *Caml* List,
(* version francaise affreuse a` la fin *)
I have been working on deriving a hierarchy of module signatures and
modules (not classes!) for the benefit of the community (and mine I
expect).
Trying to mimic this description as undertaken by specification
formalisms I have been trying to build signatures by piecewise
composition (believe me, this might have some interest):
(* defining a partial order *)
module type ORDER =
sig
type t
val (<=) : t -> t -> bool
end;;
(* defining a total order *)
# module type TOTAL =
sig
type t
val compare : t -> t -> int
end;;
module type TOTAL = sig type t val compare : t -> t -> int end
# module type MIXED =
sig
include ORDER
include TOTAL with type t = t (* THIS IS THE PROBLEM *)
end;;
module type MIXED =
sig
type t
val <= : t -> t -> bool
type t = t
val compare : t -> t -> int
end
#module IntegerMixed : MIXED =
struct
type t = int
let (<=) = (<=)
let compare = (-)
end;;
Characters 31-91:
Signature mismatch:
Modules do not match:
sig
type t = int
val <= : 'a -> 'a -> bool
val compare : int -> int -> int
end
is not included in
MIXED
Type declarations do not match: type t = int is not included in type t =
t
The problem seems to be that the second "t" hides the first or the type
equation t = int vanishes.
Has anybody tried and do something remotely resembling this? Any
remarks/suggestions?
--------------------------------------------------------
J'essaye de composer des signatures des modules (les classes ne son point
question ici) morceaux par morceaux, jusque comme on fait avec les
langages d'especification formelle.
svp, voyez les exemples en haut.
Le proble`me me semble etre que le deuxie`me "t" cache le premier ou bien
que l'equation de type t = int disparait.
Est-ce qu'il y a quelqu'un que ait essaye de faire quelque chose
semblable? Commentaires/alternatifs?
--
Francisco J. Valverde Albacete
Ayudante de Universidad
Area de Tecnolog'ia Electr'onica
Dpto. de Ingenier'ia
Universidad Carlos III de Madrid
e-mail: fva@ing.uc3m.es
tel: 624 94 29
fax : 624 94 30
next reply other threads:[~1996-12-17 16:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-12-17 20:58 Francisco J. Valverde Albacete [this message]
1996-12-17 17:49 ` Wolfgang Lux
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=32B7095A.99A@ing.uc3m.es \
--to=fva@ing.uc3m.es \
--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