3 ms·
OCaml also has both, and its object system is probably more powerful.
by Denommus 12y ago
OCaml also has both, and its object system is probably more powerful.
- ClosureSpin 12y agoHow 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.