So, you can have records in one .clj file and implementations of the protocols in another .clj file?
On Nov 6, 1:43 am, Baishampayan Ghose <b.gh...@gmail.com> wrote: > > Okay, I'm trying to understand records. I read this article: > >http://freegeek.in/blog/2010/05/clojure-protocols-datatypes-a-sneak-p... > > (Clojure Protocols & Datatypes - A sneak peek by Baishampayan Ghose. I > > found it helpful, but the usage of datatypes and protocols looks/feels > > very object-oriented to me. Am I wrong? Is it just because the > > function comes before the record instance? > > > (fly hummingbird) > > > As opposed to calling: > > > hummingbird.fly() in a standard OO language. > > Records & Protocols are indeed a way of achieving polymorphism and is > quite similar to class-based single dispatch found in Java, etc. Thus > the calling conventions can look quite familiar. > > Having said that, records & protocols are fundamentally different from > class based OO since unlike classes, records & protocols don't > complect state and abstractions. > > In your standard OO example, the state as well as the abstraction > method implementations "reside" in the hummingbird object. In case of > Clojure the state is provided by the record/datatype and the method > implementations are provided by the protocols which the record type > chooses to extend. > > There is nothing wrong with OO, as long as we are not conflating > orthogonal semantics. > > Regards, > BG > > -- > Baishampayan Ghose > b.ghose at gmail.com -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en