yeah but for reasons I cannot explain yet I'm finding that working with protocols and records is a lot more concise and expressive for my evolving use case, and maybe it's because I don't fully understand how to have the same expressiveness and conciseness with multi-methods, or maybe like you said things are just easier to type with protocols.. however, i feel there is a real difference
I'm digging a little deeper now and will have some more clarity to share soon. at first I was trying to make this work like OO and spent a chunk of time trying different things then I started reading about this http://en.wikipedia.org/wiki/Common_Lisp_Object_System On Wed, May 6, 2015 at 12:52 AM, Robin Heggelund Hansen < [email protected]> wrote: > Using Records+Protocols isn't all that different from using > Map+Multimethods, in theory. > > (defrecord Person [name age]) > (extend-protocoll Greeter > Person > (greet [person] (println "Hello" (:name person))) > > Isn't all that different from > > (defn Person [name age] {:name name, :age age, :type :person}) > (defmulti Greeter [p] :type) > (defmethod Greeter :person [p] > (println "Hello" (:name person))) > > The first version is just a lot faster (up to 5x faster), and easier to > type. Conceptually however, they are the same. > > -- > You received this message because you are subscribed to the Google Groups > "Reagent-Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/reagent-project. > For more options, visit https://groups.google.com/d/optout. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
