4 ms·
OCaml has real objects and classes. Moreover, it is trivial to demonstrate that your example doesn't work in practice: module Foo = struct let first() = 1
by colllectorof 7y ago
OCaml has real objects and classes. Moreover, it is trivial to demonstrate that your example doesn't work in practice:
module Foo = struct
let first() = 1
let second() = first() + 1
end
module Bar = struct
include Foo
let first() = 0
end
Bar.second () will still be 2 because of static binding. Thus you cannot use this approach to replace 'first' by itself without creating inconsistencies.