From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p2HAlN8n008331 for ; Thu, 17 Mar 2011 11:47:23 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ai4EAM6CgU1V2gB4h2dsb2JhbAClYQEBAQoLCR0lxE0NhVYEkEU X-IronPort-AV: E=Sophos;i="4.63,198,1299452400"; d="scan'208";a="94312739" Received: from emailfrontal1.citycable.ch ([85.218.0.120]) by mail2-smtp-roc.national.inria.fr with SMTP; 17 Mar 2011 11:47:18 +0100 X-Alinto-smtpauth-localdomain: Yes Received: from seldon (unknown [85.218.93.111]) (Authenticated sender: guillaume.yziquel@citycable.ch) by emailfrontal1.citycable.ch (Postfix) with ESMTPA id CF17212C8F9; Thu, 17 Mar 2011 11:47:16 +0100 (CET) Received: from yziquel by seldon with local (Exim 4.72) (envelope-from ) id 1Q0Ajf-0002rE-AB; Thu, 17 Mar 2011 11:47:19 +0100 Date: Thu, 17 Mar 2011 11:47:19 +0100 From: Guillaume Yziquel To: Pierre-Alexandre Voye Cc: caml-list@inria.fr Message-ID: <20110317104719.GH22969@localhost> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id p2HAlN8n008331 Subject: Re: [Caml-list] Re: Define class and sum type in one time Le Thursday 17 Mar 2011 à 11:33:44 (+0100), Pierre-Alexandre Voye a écrit : > 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 You cannot declare a class and a type with an 'and'. Either two classes, or two types. Simply declare truc before machin. type truc = Machin of int -> int | Recur of truc class machin = object val mutable valeur : truc option = None method getValeur = valeur end -- Guillaume Yziquel