On 14 June 2012 11:17, Jim - FooBar(); <jimpil1...@gmail.com> wrote:
> On 14/06/12 06:38, Philip Potter wrote:
>>
>>
>> Another reason the interface exists is for interoperability - if you want
>> a java class to participate in the protocol, you do it by implementing the
>> corresponding interface.
>>
>> Phil
>>
>
> People suggested that I should not consume the interface produced by a
> protocol definition from external sources (like a java class)...I think
> someone suggested I should use definterface instead for that reason...
It depends what you're trying to achieve.

You shouldn't use defprotocol if you are trying to create a java
interface. You should just use definterface.

Sometimes the abstraction you want really is a protocol and not an
interface. Then you should use defprotocol. Then, if later you (or
someone using your library) wants to write a Java class which
participates in the protocol, they can implement the interface.

Phil

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