3 ms·
Absolutely. 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 o
by osener 7y ago
Absolutely. 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