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>
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



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