Hello,

I started several days ago to use version 3.12.0+beta1
(at the suggestion of a colleague to whom I explained
what I need).

I have one main problem, which I see as a bug.
The code I want to write is the following:

module IntList = Set.Make(struct type t=int let compare x y = x-y end) ;;

module type Simple =
   sig
     type t
end ;;

module type Abc =
   functor (M:Simple) ->
   sig
      val x : M.t
   end
;;

module MyModule :
   sig
      include Abc(module type of IntSet)
      val y : int
   end
=
   struct
      let x = IntSet.empty
      let y = 0
   end
;;

The code gives a syntax error on the include line of the
signature of MyModule. I also tried several variants of the code,
including:
 include Abc(IntSet) instead of the rejected include
or
 module type TTT = Abc(IntSet) ;;
 ...
 include TTT

In the manual, it appears that these syntaxes are indeed not
permitted, which I think is a bug, given that converting all
module types to full module makes everything work smoothly:

module IntList =
 struct
   include Set.Make(struct
     type t = int
     let compare x y = x - y
   end)
   let zero = empty
 end
;;

module type Simple =
 sig
   type t
   val zero : t
 end
;;

module Abc (M:Simple) :
 sig
   val x : M.t
 end
=
 struct
   let x = M.zero
 end
;;

module MyModule :
   sig
     include module type of Abc(IntList)
     val y : int
   end
   =
 struct
   let x = IntList.empty
   let y = 10
 end
;;

Of course, transforming module types into modules
just for the purpose of writing "module type of "
defeats the very purpose of interfaces (this is why I
think this is a bug, not a feature). Can someone help me
(e.g., with a bugfix)?

Yours,
Dumitru


<<attachment: dumitru_potop_butucaru.vcf>>

_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

Reply via email to