2 ms·
Clojure even goes beyond what java can do with protocols and defrecord is basically a class. So you could almost say its OO from the point of the original descr
by nickik 16y ago
Clojure even goes beyond what java can do with protocols and defrecord is basically a class. So you could almost say its OO from the point of the original description (encapsulation (with name spaces), polymorphism (multi methods). Inheritance you can do with the ad hoc hierarchy system. Its pretty cool. The thing is just in Clojure you only use this stuff when it is useful not like in mainstream OO where you have to drag it along with you all the time and therefor miss out on all the functional goodness (and on lisp/concurrency goodness)
See this short video about protocols (and a little generic method and defrecord stuff): http://vimeo.com/11236603 http://vimeo.com/11236603
(you should look at it even if you don't like clojure, it has some interesting stuff in it about the expression problem, and how to solve it in there)