From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2HB1Dj1009439 for ; Thu, 17 Mar 2011 12:01:13 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgEAAaHgU3Cpx5ei2dsb2JhbAClTRQBAQEKCwsbJcQxhWMEkCsa X-IronPort-AV: E=Sophos;i="4.63,198,1299452400"; d="scan'208,217";a="78569352" Received: from sucre.univ-orleans.fr ([194.167.30.94]) by mail3-smtp-sop.national.inria.fr with ESMTP; 17 Mar 2011 12:01:07 +0100 Received: from localhost (localhost [127.0.0.1]) by sucre.univ-orleans.fr (Postfix) with ESMTP id B3EE794422; Thu, 17 Mar 2011 12:01:06 +0100 (CET) Received: from sucre.univ-orleans.fr ([127.0.0.1]) by localhost (sucre.univ-orleans.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r34oo0-bbd-U; Thu, 17 Mar 2011 12:01:06 +0100 (CET) Received: from smtps.univ-orleans.fr (smtps.univ-orleans.fr [194.167.30.152]) by sucre.univ-orleans.fr (Postfix) with ESMTP id 9781D94421; Thu, 17 Mar 2011 12:01:06 +0100 (CET) Received: from [192.168.6.18] (unknown [80.70.32.140]) by smtps.univ-orleans.fr (Postfix) with ESMTP id C5A1636E60; Thu, 17 Mar 2011 12:01:07 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: multipart/alternative; boundary=Apple-Mail-2--70081967 From: David Rajchenbach-Teller In-Reply-To: Date: Thu, 17 Mar 2011 12:01:05 +0100 Cc: caml-list Message-Id: <884CCEF4-03CB-42CA-8D90-A2B4709E8CED@univ-orleans.fr> References: <20110317104719.GH22969@localhost> To: Pierre-Alexandre Voye X-Mailer: Apple Mail (2.1082) Subject: Re: [Caml-list] Re: Define class and sum type in one time --Apple-Mail-2--70081967 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii You'll probably need something along the lines of: class maclasse = object(self) val mutable valeur = (None : truc option) method getValeur = valeur end let truc_maker('a) = Machin of 'a -> int | Recur of truc_maker('a) let truc = truc_maker(maclasse) On Mar 17, 2011, at 11:50 AM, Pierre-Alexandre Voye wrote: > So, this is impossible ? : > > class maclasse = object(self) > val mutable valeur = (None : truc option) > method getValeur = valeur > end > and > truc = Machin of (maclasse->int) | Recur of truc;; > > ? > (three attempt to write a correct example of my problem.. All apologies !) > > 2011/3/17 Guillaume Yziquel > > > > -- > --------------------- > Isaac Project - http://www.lisaac.org/ --Apple-Mail-2--70081967 Content-Transfer-Encoding: 7bit Content-Type: text/html; charset=us-ascii
You'll probably need something along the lines of:

class maclasse = object(self)
  val mutable valeur = (None : truc option)
  method getValeur = valeur
end
let truc_maker('a) = Machin of 'a -> int | Recur of truc_maker('a)
let truc = truc_maker(maclasse)

On Mar 17, 2011, at 11:50 AM, Pierre-Alexandre Voye wrote:

So, this is impossible  ?   :

class maclasse = object(self)
  val mutable valeur = (None : truc option)
  method getValeur = valeur
end
and
truc = Machin of (maclasse->int) | Recur of truc;;

?
(three attempt to write a correct example of my problem.. All apologies !)

2011/3/17 Guillaume Yziquel <guillaume.yziquel@citycable.ch>



--
---------------------
Isaac Project - http://www.lisaac.org/

--Apple-Mail-2--70081967--