>> 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. > > Even more so, the value, state, *and* polymorphism "reside" in the > hummingbird object (as do a number of other things). With records and > protocols, the values live in the record; the polymorphism lives in > the protocol; and the state (if any) lives in whatever reference type > you use. Clojure takes the many, many features that classes and > objects typically have, and separates them each into their own place: > composable where useful, but fundamentally separate.
+1. My exact thoughts. 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