gui.mli: class type control = object val id: int end gui.ml: class control = let new_id = next_id () in object (self) val id = new_id end