Created
August 20, 2018 14:22
-
-
Save keleshev/18fa6cd580b665c0995ebef04150d37e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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