I've not worked with protocols much, but saw a good fit recently. However, I'm a little bit unsure about this situation. I have some Thrift objects that I'd like to be able to easily unpack into maps, so I created a protocol
(defprotocol Unpackable (unpack [x])) Thrift has two main data types - structs and unions that need to be handled differently. Structs always implement the interface TBase. Unions extend the abstract class TUnion which in turn implements the interface TBase. So I'm extending my protocol to these types like this: (extend-protocol IUnpackable TUnion (unpack [x] (unpack-union x)) TBase (unpack [x] (unpack-struct x (get-meta-data (class x))))) It all seems to work correctly, but I'm a little unsure that it is guaranteed to work especially in the case of a union. Since a union extends TUnion, but also implements TBase will a call to (unpack the-union) do the right thing (go to unpack-union instead of unpack-struct) every time? Thanks. -- -- 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 --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.