[
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: | -- (:) |
| From: | Jérémie Dimino <jeremie@d...> |
| Subject: | Re: [Caml-list] storing object in record |
Michael wrote:
> it seems that I'm not able to figure out how to do this:
>
> class baseclass = object(this)
> method asBase = (this :> baseclass)
> (* ... *)
> end;;
>
> class ex = object inherit baseclass method name = "ex" end
>
> type state_rec = { mutable state: 'a. #baseclass as 'a };;
There is no value of type: forall 'a. #baseclass as 'a.
I think what you want to do is:
type state_rec = { mutable state: exists 'a. #baseclass as 'a };;
You can actually do this with objects:
type state_rec = { mutable state : baseclass }
{ state = (x :> baseclass) }
cheers,
Jérémie