Dear all, I have written a small experimentation about type-classes in Clojure 1.2, build above protocols. It's not a proposal, not even a good idea, just an idea that was easy enough to try.
It allows to give some rules to Clojure in order to extend Protocols when some protocol/interfaces are satisfied/implemented. For example, this (totally pointless) example works (at least on my computer): (defprotocol Incr (increment [x])) (defprotocol Decr (decrement [x])) (defprotocol Neg (negate [x])) Then, you can create a rule (type-classes/=> (Incr Neg) () ; ( protocols needed) (intefraces needed) for the rule to apply Decr (decrement [x] (negate (increment (negate x))))) After that, calling decrement on any instance of both Incr and Neg, would create an extension of Decr for that type (only at the first call) and call it. (Doing that AOT is more or less planned) I have a bigger (and as much pointless) example in the repository. So the code and a bigger example can be found at: http://nicolasoury.repositoryhosting.com/trac/nicolasoury_type-classes/wiki Comments, suggestions and idea for better examples are very much welcome. Best regards, Nicolas. -- 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