A couple of more thoughts on this. On Oct 28, 12:46 pm, Howard Lewis Ship <hls...@gmail.com> wrote: > (extend-type cascade.Asset > ToAttributeValueString > (to-attribute-value-string [asset] (:client-url asset)))
The reason this is probably not what you really want is that the set of types which satisfy the Asset protocol is a superset of the set of types which satisfy the cascade.Asset interface. This is certainly not immediately obvious, but one way to understand it is that if you extend a built-in Java type to implement your protocol, it does not change the underlying type to implement the protocol's interface. Rather it provides machinery in the protocol itself that knows how to use the built-in Java type to satisfy the protocol. > I don't think it is useful to try and think of this as interface > inheritance because it is not the same as interface inheritance in > Java. I wasn't used to thinking of it as inheritance, but after thinking about it more it seems like "inheritance" is a reasonable way to think of it. Adapting protocol A to protocol B is like saying that all types satisfying protocol B can also be used as if they satisfy protocol A and furthermore there is a default implementation (that can be over- ridden) of protocol A for them. -David -- 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