On Thursday, October 25, 2012 11:32:11 AM UTC-7, Jim foo.bar wrote: > > On 25/10/12 19:20, Raoul Duke wrote: > > On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft > > <craft...@gmail.com<javascript:>> > wrote: > >>> http://www.ibm.com/developerworks/library/j-clojure-protocols/ > >> since different protocols would collide. E.g. two shapes represented by > maps > >> are going to dispatch to the same "area" protocol, I think, since > they're > >> both maps. > > i suspect it shouldn't be a problem, since i thought protocols are to > > support specialization of function per (single dispatchy) type? > > > > Protocols go hand-in-hand with records in order to provide the fastest > polymorphic behaviour possible which is no other that type-based > dispatch...I still don't understand why you 'd want that from what > you've described so far... > Going back to your graphics example, I think I've had similar situation > in one of my GUIs...I had a canva-react fn that worked for the game of > chess but not for any other games. So yes, I made it a multi-method and > now consumers of the lib that are supposed to build board-games with i,t > can simply add their own canva-react that handles their game...Does this > sound similar to what you're trying to do?
Yes, it does. Ok, so: multimethods. Multimethods seem like a convenience layer over duck typing: probe the object to see what it is, then dispatch. Is that a fair description? -- 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