Version française
Home     About     Download     Resources     Contact us    
Browse thread
using functors in objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Andrej Bauer <Andrej.Bauer@a...>
Subject: Re: [Caml-list] using functors in objects
Perhaps something like this with recursive modules. I have a feeling it
can be simplified, though.

Andrej

--------------------
module A (X: sig type t end) =
struct
  class c =
  object
    val b = (None : X.t option)
  end
end

module rec D : sig
  class d : object val b : D.d option end
end =
struct
  class d =
  object
    inherit Y.c
  end
end

and Y :
sig
  class c : object val b : D.d option end
end =
  A(struct type t = D.d end)

class d = D.d

----------------