From: "Jérémie Dimino" <jeremie@dimino.org>
To: Michael <micha-1@fantasymail.de>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] storing object in record
Date: Wed, 08 Apr 2009 09:54:48 +0200 [thread overview]
Message-ID: <1239177288.6630.41.camel@localhost.localdomain> (raw)
In-Reply-To: <200904080936.16263.micha-1@fantasymail.de>
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
next prev parent reply other threads:[~2009-04-08 7:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 7:36 Michael
2009-04-08 7:54 ` Jérémie Dimino [this message]
2009-04-08 10:29 ` [Caml-list] " Michael
2009-04-08 11:36 ` Jérémie Dimino
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1239177288.6630.41.camel@localhost.localdomain \
--to=jeremie@dimino.org \
--cc=caml-list@yquem.inria.fr \
--cc=micha-1@fantasymail.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox