- : unit = ()
type 'b class_name = .. constraint 'b = < cast : 'a. 'a name -> 'a; .. >
and 'a name =
    Class : 'a class_name -> (< cast : 'a0. 'a0 name -> 'a0; .. > as 'a) name
exception Bad_cast
class type castable = object method cast : 'a name -> 'a end
class type foo_t = object method cast : 'a name -> 'a method foo : string end
type 'b class_name += Foo : foo_t class_name
class foo : foo_t
class type bar_t =
  object
    method bar : string
    method cast : 'a name -> 'a
    method foo : string
  end
type 'b class_name += Bar : bar_t class_name
class bar : bar_t
val clist : castable list ref = {contents = []}
val push_castable : #castable -> unit = <fun>
val pop_castable : unit -> castable = <fun>
- : unit = ()
- : unit = ()
- : unit = ()
val c1 : castable = <obj>
val c2 : castable = <obj>
val c3 : castable = <obj>
val f1 : foo = <obj>
val f2 : foo = <obj>
val f3 : foo = <obj>
Exception: Bad_cast.
val b2 : bar = <obj>
Exception: Bad_cast.

