* Extending a class constrained in a signature
@ 2009-04-17 10:45 Jean Balthazar
0 siblings, 0 replies; only message in thread
From: Jean Balthazar @ 2009-04-17 10:45 UTC (permalink / raw)
To: caml-list
[-- Attachment #1: Type: text/plain, Size: 932 bytes --]
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)
[-- Attachment #2: Type: text/html, Size: 1130 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-04-17 10:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17 10:45 Extending a class constrained in a signature Jean Balthazar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).