Hacker News new | ask | show | jobs
by tome 2117 days ago
If you define "OO" to mean "has any form of ad hoc polymorphism" then I agree that Haskell is an OO language. On the other hand, I suspect most of the profession would assume that the polymorphism requirements in the definition of OO extend only so far as what Java, C++ and Python provide, that is, subclass-based polymorphism implemented using a vtable reference per object (or equivalent). The Haskell community certainly does not consider type classes to be a feature that provides "OO".

When I enter these debates I assume we're talking about OO in the de facto sense described above. Under that nomenclature I agree that ad hoc polymorphism is a useful language feature but believe that the OO implementation of it is bad.

1 comments

This confusion of "what is meant by OO" is what my original comment was about.

The "hate" of OO is a misunderstanding, because most people are confused about what everyone and anyone even means when they talk about it, and that's also true of FP by the way.

So when someone criticizes OO for example, but their criticism is directed towards the fact that in Java, I cannot add methods to the existing HashMap class if I wanted too, and that annoys me. So am I criticizing OO? I'll probably label my article "Why OO doesn't work" or something like that. When I should have probably titled it: "Why it is a problem for Java classes to not be extendable from outside their class". Or at the very least: "Why subtyping for extension isn't always the most convenient mechanism for extension."

I see this happening not just on the topic of OO, but everywhere, and I find in a technical setting this is a dangerous thing to do.

I don't really know how to call this effect. I guess stereotyping is a good word for it.