Fork me on GitHub

Hey all, I'm just going over this chapter in Clojure for the Brave and True:


I'm having a bit of difficulty understanding extending records with protocols, so I'm having a look at this Clojure reference page:


In the first paragraph of the latter link, there are references to host interfaces, host classes and the host platform. Just for clarification, are these refering to Java interfaces and classes, and the JVM, respectively?


@danp those references in the first paragraph are about the implementation details of Clojure JVM, i.e the way that collections etc are implemented.


indeed they are Java interfaces and classes, (e.g clojure.lang.ILookup, clojure.lang.PersistentArrayMap etc.)


this is not the case for ClojureScript, where protocols are at the bottom of the implementation


(which is kind of awesome)


Thanks @val_waeselynck. I thought this was the case, but didn't want to assume 🙂

sifou biri17:03:03

Hi! In reify doc, it says, methods should be supplied for all methods of desired protocol(s), but Clojure let us give a partial set implementation of protocol methods, I'm I not understanding something?


sifou nope, you don’t need to implement any of the methods, but you’ll just get an error if one gets called that wasn’t implemented


that is, no, you don’t misunderstand, clojure lets you implement as few as you like (even 0), and you just get a run time error later if they are called

sifou biri17:03:07

@noisesmith I see, thank you for clarification 🙂 So that's what is meant in doc string


sifou I guess by “should’ they mean “it’s probably a good idea…"

sifou biri17:03:56

@noisesmith yes 🙂