A question about the kind of OO stuff that clj and cljs provide. In cljs, we have specify and specify! and not in clj. What’s the reason for this diff between cljs and clj?
@viebel probably because it’s hard to pull off on the JVM - or not really feasible
Clojure often claims that “Concrete derivation is bad”
Does it mean that specify should be avoid?
“concrete derivation is bad” I think is in the context of classes
specify operates on instances
IIRC specify was created (along with clone) by David Nolen to implement om’s cursors
Implementing cursors without some kind of generic proxying would be really rough
Do you remember what features of cursor would be hard without generic proxying
?
Uh, the whole thing
A cursor wraps a particular instance of a data structure, but adds extra contracts (the root, it’s path in the data structure, protocols to transact against the mutable container that holds it)
for it to, at runtime, both behave/type like a normal collection (whatever type it is) and also have these extra things added, you need to delegate some interfaces related to cursoring and pass through unrelated ones you don’t know about. You can do this in Java with reflection (DynamicProxy I think); but in JS it’s faster and easier to adjust the prototype.
Thanks a lot for those clarifications