Version française
Home     About     Download     Resources     Contact us    
Browse thread
Piece composition of signatures (& problems derived from them too!)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Francisco J. Valverde Albacete <fva@i...>
Subject: Piece composition of signatures (& problems derived from them too!)
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