Skip to content

Instantly share code, notes, and snippets.

@keleshev
Created August 20, 2018 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save keleshev/18fa6cd580b665c0995ebef04150d37e to your computer and use it in GitHub Desktop.
Save keleshev/18fa6cd580b665c0995ebef04150d37e to your computer and use it in GitHub Desktop.
#! /usr/bin/env ocaml
type some_interface = <
foo : unit -> unit
>
let do_stuff (p : some_interface) =
p#foo ()
class class_a = object (self)
method foo () = ()
end
let () =
do_stuff (new class_a)
class class_b = object (self)
method not_foo () = ()
end
let () =
do_stuff (new class_b) (* Compile-time error *)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment