This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-15
Channels
- # arachne (6)
- # aws-lambda (3)
- # beginners (14)
- # boot (56)
- # cider (8)
- # cljs-dev (5)
- # cljsrn (11)
- # clojure (240)
- # clojure-dusseldorf (3)
- # clojure-greece (165)
- # clojure-italy (5)
- # clojure-romania (1)
- # clojure-russia (24)
- # clojure-uk (30)
- # clojure-ukraine (3)
- # clojurescript (29)
- # core-async (6)
- # css (1)
- # cursive (25)
- # datascript (6)
- # datomic (61)
- # dirac (1)
- # events (3)
- # hoplon (1)
- # instaparse (3)
- # jobs (4)
- # juxt (28)
- # lein-figwheel (7)
- # leiningen (19)
- # luminus (1)
- # lumo (2)
- # nyc (1)
- # off-topic (19)
- # om (25)
- # onyx (4)
- # parinfer (2)
- # pedestal (23)
- # perun (20)
- # re-frame (44)
- # reagent (20)
- # remote-jobs (3)
- # ring (3)
- # ring-swagger (5)
- # rum (12)
- # slack-help (3)
- # spacemacs (25)
- # specter (62)
- # sql (16)
- # unrepl (313)
- # yada (4)
Hey all, I'm just going over this chapter in Clojure for the Brave and True: http://www.braveclojure.com/multimethods-records-protocols/
I'm having a bit of difficulty understanding extending records with protocols, so I'm having a look at this Clojure reference page: https://clojure.org/reference/datatypes
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 🙂
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
@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…"
@noisesmith yes 🙂