Summarizing: defrecord is for adding properties using composition and defprotocol to add methods using composition! Damn! Every time I like Clojure ideas more !
The funcool /cats project uses protocols and records to implement CT stuff in Clojure at type level. They have great docs and some of the stuff pretty useful, for example, Exception monad for dealing with exceptions in more "civilized" manner
Is extend-protocol always necessary? extend-protocol seems to be confusing when implemented outside the defrecord form. What would be the problem while implementing the Display protocol in the Product defrecord like the following? (defrecord Product [name] Display (title [this] (str "This product is a " name)) (description [this descr] (str "The " name " is " descr)))
really helpful, from somebody who just started to learn clojure!
Summarizing: defrecord is for adding properties using composition and defprotocol to add methods using composition! Damn! Every time I like Clojure ideas more !
protocols are awesome for documenting boundaries functionalities that you need to test/modularize
1000% this
Keep them coming! Great job creating Clojure tutorials! Short and to the point.
Thanks man!
The funcool
/cats project uses protocols and records to implement CT stuff in Clojure at type level. They have great docs and some of the stuff pretty useful, for example, Exception monad for dealing with exceptions in more "civilized" manner
Woah, I've never heard of that lib before, seems useful and also nice docs!
This video helped me so much. Thank you for making this!!
Awesome! Happy it helped :) thanks for watching!
Is extend-protocol always necessary? extend-protocol seems to be confusing when implemented outside the defrecord form. What would be the problem while implementing the Display protocol in the Product defrecord like the following?
(defrecord Product [name]
Display
(title [this] (str "This product is a " name))
(description [this descr] (str "The " name " is " descr)))
Hooray..!
There also is *reify*
Nice video, thank you. But please, don't do these sensationalized thumbnails lol. You're not a kiddo UA-camr.
Thanks for watching :) I do what I like!