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 !)
Le Thursday 17 Mar 2011 à 11:33:44 (+0100), Pierre-Alexandre Voye a écrit :
> My example would be better with this :> Â val mutable valeur = (None : truc option)
> class machin = object(self)
> Â method getValeur = valeur
> endYou cannot declare a class and a type with an 'and'. Either two classes,
> and
> truc = Machin of (int->int) | Recur of truc;;
> The object need the type defined
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