Re:Goodbye, shitty Car extends Vehicle object-orientation tu...
by andrepd on Saturday October 19, 2019 @10:05PM
(#21301924)
In OCaml:
[ Parent
| on HN ]
Re:Goodbye, shitty Car extends Vehicle object-orientation tu...
by colllectorof on Sunday October 20, 2019 @05:35PM
(#21307316)
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.