From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 93B12BBC6 for ; Wed, 8 Apr 2009 09:54:59 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAKv120nVuiYS/2dsb2JhbADNOQeDdAY X-IronPort-AV: E=Sophos;i="4.39,343,1235948400"; d="scan'208";a="25857512" Received: from solaria.dimino.org ([213.186.38.18]) by mail3-smtp-sop.national.inria.fr with ESMTP; 08 Apr 2009 09:54:50 +0200 Received: from aurora (localhost.localdomain [127.0.0.1]) by solaria.dimino.org (Postfix) with ESMTP id E0A138004C; Wed, 8 Apr 2009 09:54:49 +0200 (CEST) Received: by aurora (Postfix, from userid 1000) id 085CF44769; Wed, 8 Apr 2009 09:54:48 +0200 (CEST) Subject: Re: [Caml-list] storing object in record From: =?ISO-8859-1?Q?J=E9r=E9mie?= Dimino To: Michael Cc: caml-list@yquem.inria.fr In-Reply-To: <200904080936.16263.micha-1@fantasymail.de> References: <200904080936.16263.micha-1@fantasymail.de> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Date: Wed, 08 Apr 2009 09:54:48 +0200 Message-Id: <1239177288.6630.41.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.24.5 X-Spam: no; 0.00; mutable:01 forall:01 mutable:01 cheers:01 wrote:01 rec:01 rec:01 caml-list:01 inherit:01 objects:02 seems:03 exists:05 michael:07 storing:08 i'm:09 Michael wrote: > it seems that I'm not able to figure out how to do this: >=20 > class baseclass =3D object(this) > method asBase =3D (this :> baseclass) > (* ... *)=09 > end;; >=20 > class ex =3D object inherit baseclass method name =3D "ex" end >=20 > type state_rec =3D { 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 =3D { mutable state: exists 'a. #baseclass as 'a };; You can actually do this with objects: type state_rec =3D { mutable state : baseclass } { state =3D (x :> baseclass) } cheers, J=C3=A9r=C3=A9mie