3 ms·
Surely the ultimate example of this phenomenon is OCaml. It's wearing OOP right on its sleeve in the name of the language, but its users inevitably say "Oh, we
by frou_dh 7y ago
Surely the ultimate example of this phenomenon is OCaml.
It's wearing OOP right on its sleeve in the name of the language, but its users inevitably say "Oh, we never (or hardly ever) use that part".
- osener 7y agoAbsolutely. Objects in OCaml is useful for structural typing, but I reach for classes way less often than I initially thought I would (read: never). It turns out modules are indeed a better solution for, well, modularization. OCaml is multi-paradigm in the most broad sense of the word I've experienced, just with functional and immutable as the default rather than the other way around. And it has a pretty great OOP implementation too. Suggested reading for those wondering why the community deemed the O in OCaml mostly unnecessary and how rest of the language helps achieve the same goals in a different/better way: https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282 https://discuss.ocaml.org/t/objects-use-cases-in-ocaml/2282
- sweeneyrod 7y agoI think the lesson from OCaml is that 90% of the value of OOP comes from things like packaging datatypes with functions that use them and separating implementations from interfaces which can be implemented with non-OOP things like modules. From an OCaml perspective, the main thing that you can only get from OOP and not elsewhere is open recursion, which is useful but only in certain niches.