On 25/10/12 19:20, Raoul Duke wrote:
On Thu, Oct 25, 2012 at 11:17 AM, Brian Craft <[email protected]> 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?
Jim
ps: if you go down the protocol road most likely you'll have to change
your maps to records.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en