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/