module Cellule = struct
  exception Nil
  class ['a,'b] nulle =
    object
      method hd : 'a = raise Nil method tl : 'b = raise Nil
      method null = true
      method length = 0
    end
  class ['a,'b] cellule h t =
    object
      val hd : 'a = h val tl : 'b = t
      method hd = h method tl = t
      method null = false
      method length = 1 + tl#length
    end
end;;
module Liste3 = struct
  class ['a] nil =
    object (_:'b) inherit ['a, 'b] Cellule.nulle end
  class ['a] cons x y =
    object (_:'b) inherit ['a, 'b] Cellule.cellule x y end
end;;