Browse thread
Extending a class constrained in a signature
- Jean Balthazar
[
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: | 2009-04-17 (10:45) |
From: | Jean Balthazar <jean.balthazar.fr@g...> |
Subject: | Extending a class constrained in a signature |
Dear OCamlers (again !), I tried this time to specify explictly what I expect from a container. This specification is given by the signature CONTAINER below. Everyhting works perfectly but I don't understand why it fails if I remove the 'private' keyword... Why am I only able to extend an object when the type have the 'private' keyword in its definition? Is it possible to achieve the same behaviour using a class type rather a row type with private keyword? All the best, Jean *********************************************************************************************** module type CONTAINER = sig type 'elt container = private < hd : 'elt; .. > end module Check = functor(Coll : CONTAINER) -> struct end module Seq = struct class ['elt] container (arg : 'elt list) = object(self : 'selftype) method hd = List.hd arg method tl = new container (List.tl arg) end end module CheckSeq = Check(Seq)