From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2HBEHbq010539 for ; Thu, 17 Mar 2011 12:14:17 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AkgEAJqJgU3Cpx5ei2dsb2JhbAClTRQBAQEKCwsbJcRAhWMEkCsa X-IronPort-AV: E=Sophos;i="4.63,198,1299452400"; d="scan'208,217";a="90628052" Received: from sucre.univ-orleans.fr ([194.167.30.94]) by mail4-smtp-sop.national.inria.fr with ESMTP; 17 Mar 2011 12:14:11 +0100 Received: from localhost (localhost [127.0.0.1]) by sucre.univ-orleans.fr (Postfix) with ESMTP id F01949441E; Thu, 17 Mar 2011 12:14:10 +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 61RFyoGk7LNN; Thu, 17 Mar 2011 12:14:10 +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 C90629440E; Thu, 17 Mar 2011 12:14:10 +0100 (CET) Received: from [192.168.6.18] (unknown [80.70.32.140]) by smtps.univ-orleans.fr (Postfix) with ESMTP id 103EC36E60; Thu, 17 Mar 2011 12:14:12 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: multipart/alternative; boundary=Apple-Mail-3--69297210 From: David Rajchenbach-Teller In-Reply-To: <884CCEF4-03CB-42CA-8D90-A2B4709E8CED@univ-orleans.fr> Date: Thu, 17 Mar 2011 12:14:09 +0100 Cc: Pierre-Alexandre Voye , caml-list Message-Id: <9EB4D59D-DFE5-45E7-8218-9A9D419D7500@univ-orleans.fr> References: <20110317104719.GH22969@localhost> <884CCEF4-03CB-42CA-8D90-A2B4709E8CED@univ-orleans.fr> To: David Rajchenbach-Teller X-Mailer: Apple Mail (2.1082) Subject: Re: [Caml-list] Re: Define class and sum type in one time --Apple-Mail-3--69297210 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Arf, sorry, I got mixed with OPA syntax (or revised syntax). This was actually let 'a truc_maker = Machin of 'a -> int | Recur of 'a truc_maker let truc = maclasse truc_maker On Mar 17, 2011, at 12:01 PM, David Rajchenbach-Teller wrote: > 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-3--69297210 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
Arf, sorry, I got mix= ed with OPA syntax (or revised syntax).

This was a= ctually

let 'a truc_maker =3D Machin of 'a -> int | = Recur of 'a truc_maker
let truc =3D maclasse truc_maker

On Mar 17, 2011, at 12:01 PM, David Rajchenbach-Teller wrote:

You'll probably need something along the lines of:
<= div>
class maclasse =3D object(self)
  val mutab= le valeur =3D (None : truc option)
  method getValeur =3D vale= ur
end
let truc_maker('a) =3D Machin of 'a -> int | Rec= ur of truc_maker('a)
let truc =3D truc_maker(maclasse)

<= div>
On Mar 17, 2011, at 11:50 AM, Pierre-Alexandre Voye wrote:
So, this is= impossible  ?   :

class maclasse =3D object(self)  val mutable valeur =3D (None : truc option)
  method getVal= eur =3D valeur
end
and
truc =3D Machin of (maclasse->int) | Re= cur of truc;;

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

2011/3/17 Guillaume Yziquel <guillaume.y= ziquel@citycable.ch>



--
---------------------
Isaac Proje= ct - http://www.lisaac.org/


= --Apple-Mail-3--69297210--