Hacker News new | ask | show | jobs
by yummyfajitas 4359 days ago
Julia/Clojure/Lisp does dynamic dispatch on the argument types of the function - it's called multimethods. So it seems to fit your criteria of "dynamic dispatch + associating methods to classes".

And in some sense, it is used for object orientation - CLOS is built on it. But on the other hand, these languages are very far from what one would normally normally call "object oriented".

I do agree with you that there is some meaning to the term "object oriented" - I often completely understand what is intended by the term. Python is certainly OO, Haskell is almost certainly not. But to some extent I agree with the author - it would be very useful to have a precise definition, because I don't think that classifying stranger languages as OO is that reliable.

2 comments

Great, thanks! Your example makes a lot more sense now.

The easy way out is to say that these languages are OO in the same sense that Java is functional. Easy but maybe not unfair, particularly since all are dynamically typed.

The clojure examples make this look like OO. I would have to find a formal definition of the semantics to figure out if there's a more nuanced explanation than the easy one above.

And yes, I think I agree with the last bit. The author's observation that lines can become blurred is certainly valuable and true. It's the author's conclusion that the term OOP is therefore meaningless which is, imo, empirically false.

edit: stray punctuation

CLOS is completely, thoroughly, dyed-in-the-wool object oriented. It gives you generic functions which dispatch methods, by considering the class type of every (specializable) parameter. CLOS also avoids the silly problems by not putting methods into a class scope and dealing with symbol-table conflicts upon inheritance: like when inheriting from "graphical" and "lottery", working out whether the "draw" method renders pixels, or performs a lottery pick.

The CLOS design absolutely nails OO, and that's even before we look at the meta-object protocol.