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 p2HAXpmV007604 for ; Thu, 17 Mar 2011 11:33:51 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AksCAA2AgU1KfVI0kGdsb2JhbACEPqEHCBQBAQEBCQkNBxQEIak/igI8gh6FFS+IWwEBAwWEZ3cEjF6Gc4IGOg X-IronPort-AV: E=Sophos;i="4.63,198,1299452400"; d="scan'208";a="78566701" Received: from mail-ww0-f52.google.com ([74.125.82.52]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 17 Mar 2011 11:33:45 +0100 Received: by wwj40 with SMTP id 40so3375912wwj.9 for ; Thu, 17 Mar 2011 03:33:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=pzr6Lt0s735ndIibSDQFHJkzJ9HNAcu5WA/LAOVxZm0=; b=GKd5GzMMiPyZEq5ORxEZIzaU6s0oXihaW0MGBXrds/hD8CrSqeogVjVLpswXVUCVh8 /ez+FgyDSiT/rTltBs19vtMR3omS8e38m52Wi+WsH+JxRU9qMgz7Z4clMyRTU8RZlYG2 wHknY+NVUmJCH6pDTolUZUzb+9yPliFamY320= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=QmLz1w/TOCCull2BlbHVSH9+vrBQYm13QldkIeKUQ0Bt3Pxm8tnTB1P6g8sOA1oQ6c f63lbIpfx/xyBCV7NJ2A90QcR3USdxRfwMoCGvkuUxdYQPlC/WpVDnQ6YkY863Bp4t/j g6sQQwVk0VEiUKUtrUmYijzaNaMy5K8deTkpc= MIME-Version: 1.0 Received: by 10.216.239.65 with SMTP id b43mr1213547wer.29.1300358024825; Thu, 17 Mar 2011 03:33:44 -0700 (PDT) Received: by 10.216.74.5 with HTTP; Thu, 17 Mar 2011 03:33:44 -0700 (PDT) In-Reply-To: References: Date: Thu, 17 Mar 2011 11:33:44 +0100 Message-ID: From: Pierre-Alexandre Voye To: caml-list Content-Type: multipart/alternative; boundary=e0cb4e43d1cd268ec0049eab3254 Subject: [Caml-list] Re: Define class and sum type in one time --e0cb4e43d1cd268ec0049eab3254 Content-Type: text/plain; charset=UTF-8 My example would be better with this : class machin = object(self) val mutable valeur = (None : truc option) method getValeur = valeur end and truc = Machin of (int->int) | Recur of truc;; The object need the type defined 2011/3/17 Pierre-Alexandre Voye > Hi everyone, i'm trying to write a generic hierarchical finite state > machine, and I have a syntax problem which stop me. > I want to define an object which use, somewhere a sum type. > The compiler answer "Syntax Error" > > Here a simple example of my problem : > > class machin = object(self) > val mutable valeur = 0 > method getValeur = valeur > end > and > truc = Machin of (int->int) | Recur of truc;; > > And the answer : > Error: Syntax error > which point on the "of" after "Machin" > > Is there a way to solve this problem ? > > In advance, thank you very much > > Pierre-Alexandre > -- > --------------------- > Isaac Project - http://www.lisaac.org/ > -- --------------------- Isaac Project - http://www.lisaac.org/ --e0cb4e43d1cd268ec0049eab3254 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable My example would be better with this :

class machin =3D object(self)=
=C2=A0 val mutable valeur =3D (None : truc option)
=C2=A0 method get= Valeur =3D valeur
end
and
truc =3D Machin of (int->int) | Recu= r of truc;;

The object need the type defined

2011= /3/17 Pierre-Alexandre Voye <ontologiae@gmail.com>
Hi everyone, i'm trying to write a generic hierarchical finite state ma= chine, and I have a syntax problem which stop me.
I want to define an ob= ject which use, somewhere a sum type.
The compiler answer "Syntax = Error"

Here a simple example of my problem :

class machin =3D object(se= lf)
=C2=A0 val mutable valeur =3D 0
=C2=A0 method getValeur =3D valeu= r
end
and
truc =3D Machin of (int->int) | Recur of truc;;
=
And the answer :
Error: Syntax error
=C2=A0which point=C2=A0 on the "of" after = "Machin"

Is there a way to solve this problem ?

In = advance, thank you very much

Pierre-Alexandre
--
---------------------
Isaac Project - http:/= /www.lisaac.org/



--
----------------= -----
Isaac Project - http://www.lisa= ac.org/
--e0cb4e43d1cd268ec0049eab3254--