3 ms·
How come?
by ClosureSpin 12y ago
How come?
- Denommus 12y agoBesides the object system, OCaml has a powerful module system, with first-class modules and functors (which is already basically very equivalent to what you'd expect from objects). Besides that, objects have structural typing, and you can even create objects without classes (somewhat similarish to anonymous classes, except instead of interfaces you have the structural typing to give you something like statically typed duck typing). OCaml also has multiple inheritance and friend classes.