Hi,
On Feb 9, 12:13 am, aria42 <ari...@gmail.com> wrote: > Is it possible to have default implementations associated with > functions in a protocol? This is most useful when some protocol > functions are defined in terms of other. For instance, > > (defprotocol Span > (start [self]) > (stop [self]) > (span-length [self])) > > Now I know I can just make span-length a function on Span as opposed > to part of the protocol. Is that what one should do? The last time I checked, it was my understanding the mix-ins are used for this. (defprotocol Thing (abc []) (xyz [])) (def AThing {:abc (fn [] ...) :xyz (fn [] ....)}) (deftype Banana ...) (extend Thing Banana (merge AThing {:abc (fn []...)})) This would effectively use the "default" implementation of xyz and provide a custom one for xyz. But I'm not up-to-date with the protocol stuff. Sincerely Meikel -- 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