> A more concrete example: say I've defined a protocol for AST nodes in > 1.0 of a library, and later when developing 2.0 I discover it would > have been a good idea to have a "pretty-print" method on nodes to show > human-readable output. If the protocol had Trait-like characteristics > I could add pretty-print to the protocol, with a default > implementation that just prints the fields of the node, but override > that with a better implementation for some of the new record types I'm > including in 2.0.
Is this because you've got Java clients coding against your interfaces? In Clojure I'd like to do something like: (doseq [node (walk-tree)] (pretty-print node)) and have it work regardless of how each node is made. I'd expect (pretty-print) to do more work if it can't just do (.pretty-print node), but client code need not be affected and the API need not be versioned in the sense IFoo, IFoo2, etc. That is, I'd think that custom Clojure libraries would be modeled after the sequence library and use protocol/types as implementation details, unless it's a "Java API" done in Clojure (which I anticipate doing myself actually). -- 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