4 ms·
Clojure's anti-OO stance is far subtler than people seem to understand. It's primarily about not reaching for classes as a first tool and eliminating local stat
by swannodette 12y ago
Clojure's anti-OO stance is far subtler than people seem to understand. It's primarily about not reaching for classes as a first tool and eliminating local state (and even this is allowed!)
However there are times when the OO approach makes sense and you have a full range of tools from multimethods to protocols. In ClojureScript you even have Self-like functionality in the form of `specify`.
- mikerichards 12y agoMultimethods and Protocols seem to get better results than what OO is trying to achieve...at least when it comes to polymorphism.
- dkersten 12y agoIs there any documentation on "specify"? I've seen it used from time to time (eg in your Om code), but the only documentation I've found is the dev wiki page[1]. [1] http://dev.clojure.org/display/design/specify+i.e.+reify+for+instances http://dev.clojure.org/display/design/specify+i.e.+reify+for...
- swannodette 12y agoAt the moment there is not, someone should add something to the wiki. Basically it clones the target and adds the specified protocol implementations - basically instance level extend-type.
- ddellacosta 12y agoThis is an old post but I talk about it a bit here (toward the bottom): http://www.davedellacosta.com/cljs-protocols http://www.davedellacosta.com/cljs-protocols (I need to update my github link to point to a static version of Om's code!)