On Nov 13, 3:58 am, Konrad Hinsen <konrad.hin...@fastmail.net> wrote: > On 13 Nov 2009, at 08:13, Mark Engelberg wrote: >
> > Protocols: > > > I don't understand whether there's any way to provide a partial > > implementation or default implementation of a given > > protocol/interface, and I believe this to be an important issue. > > I don't think that partial implementations are possible at the moment, > but I agree that it would be useful. Yes, just create mixin maps and use them in your extends. > A default implementation can be > provided as an implementation of Object. It's not quite the same as a > default implementation for a multimethod, as it doesn't apply to types > identified by a metadata type tag, but in practice it can be good > enough or even better. > That's not true for protocols. Make sure to leave any preconceptions from multimethods and type tags behind. In particular, protocols do not, and will not, utilize the isa/hierarchy system. Right now, the dispatch code routes through (type x), but the intention is to support through type only classes and deftype types. The use of type metadata should be deprecated once this in place. At that point, Object does serve as the default for everything other than nil. ***But*** one should generally avoid using hierarchy for implementation inheritance! You may encounter it in interop situations, but otherwise use mixins. Rich -- 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