The surface of the problem is reduced because of namespacing: two different "fold" methods (with different semantics) from two protocols won't clash. Plus if there are two extensions of the same protocol to the same type, they should be rather equivalent since they satisfies the same semantics.
Incidentally, this is the difference between pre-web and post-web tools. Before the web, databases and identifiers would be "age", or "name"; after the web we'd have "http://foo.com/age", or in Clojure com.foo/age.
The former behaves as if it owns the entire world, and it's very likely to result in collisions; the latter is very unlikely. This issue of ambiguous identification is one of the problems that semantic web tools try to solve.
The former, of course, is how Ruby works -- if you open the string class and add a 'frob' method, then it will clash with someone else's 'frob' method. The latter is how Clojure works, because protocols are namespaced, and good namespaces are reverse domains or otherwise controlled.
If you use com.foo.bar/frob, you're claiming to obey the contract of that particular frob operation, so even in the situation where collision occurs, both implementations should at least share a conception of what 'frobbing' means.
I think one must only extend a protocol to a type if he owns either the type or the protocol.
That sounds like a reasonable rule of thumb, though I'd change it to "publicly extend", or add "if you want to be safe" :)
-- 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