I think the extend function is made exactly to support the concrete
implementation of protocols.  It takes a type, and then any number of
protocol + function map pairs, where keyword names map to functions.
Checkout the protocol docs on assembla and look for extend:

http://www.assembla.com/wiki/show/clojure/Protocols

or read a recent post by Rich where he talks about some of the design
decisions behind these constructs:

http://groups.google.com/group/clojure/msg/330c230e8dc857a9

-Jeff Rose

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?

-- 
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

Reply via email to