Why doesn't OCaml have typeclasses (or something similar)?

Which leads to the design of modular implicits, where you can bring other definitions into scope. This design I’ve critiqued earlier, based on experience with Scala (though Scala’s implicits is a bit different from modular implicits in its details).

I still see the resulting problem of there being invisible ‘holes’ in the code to be filled out as a big problem for readability (even though several instances can’t be in scope at the same time) - which goes directly against what (that has also been mentioned here) I see as a major advantage of OCaml over other languages; simplicity and readability.

As has also been mentioned in other threads (and earlier in this thread) - it’s possible to get several of the niceties of implicits via other features.

OCaml should not try to copy other hyped languages just to copy them; keep the identity and advantages of the language in sight.

3 Likes