(* comments after each toplevel definition == what REPL outputs *)
class ['a] adder next (init : 'a) = object
val mutable sn = init
method get_next =
sn <- next sn;
sn
end
(*
class ['a] adder :
('a -> 'a) -> 'a -> object val mutable sn : 'a method get_next : 'a end
*)
let govno_lambda = fun x -> x + 1
(*
val govno_lambda : int -> int = <fun>
*)
class govno_adder
= [int] adder govno_lambda
(*
class govno_adder : int -> [int] adder
*)
let ad = new govno_adder 10
(*
val ad : govno_adder = <obj>
*)
(*
11- : unit = ()
*)
KCogY29tbWVudHMgYWZ0ZXIgZWFjaCB0b3BsZXZlbCBkZWZpbml0aW9uID09IHdoYXQgUkVQTCBvdXRwdXRzICopCgpjbGFzcyBbJ2FdIGFkZGVyIG5leHQgKGluaXQgOiAnYSkgPSBvYmplY3QKICB2YWwgbXV0YWJsZSBzbiA9IGluaXQKICBtZXRob2QgZ2V0X25leHQgPQogICAgc24gPC0gbmV4dCBzbjsKICAgIHNuCmVuZAooKgpjbGFzcyBbJ2FdIGFkZGVyIDoKICAoJ2EgLT4gJ2EpIC0+ICdhIC0+IG9iamVjdCB2YWwgbXV0YWJsZSBzbiA6ICdhIG1ldGhvZCBnZXRfbmV4dCA6ICdhIGVuZAoqKQoKbGV0IGdvdm5vX2xhbWJkYSA9IGZ1biB4IC0+IHggKyAxCigqCnZhbCBnb3Zub19sYW1iZGEgOiBpbnQgLT4gaW50ID0gPGZ1bj4KKikKCmNsYXNzIGdvdm5vX2FkZGVyID0gW2ludF0gYWRkZXIgZ292bm9fbGFtYmRhCigqCmNsYXNzIGdvdm5vX2FkZGVyIDogaW50IC0+IFtpbnRdIGFkZGVyCiopCgpsZXQgYWQgPSBuZXcgZ292bm9fYWRkZXIgMTAKKCoKdmFsIGFkIDogZ292bm9fYWRkZXIgPSA8b2JqPgoqKQoKbGV0ICgpID0gcHJpbnRfaW50IGFkI2dldF9uZXh0CigqCjExLSA6IHVuaXQgPSAoKQoqKQo=