you can check for the existence of the protocol's var just like you
would for any var. not sure what B. Ghose is getting at, but I would
recommend not checking for the existence of the interface.

http://clojure.org/vars

On Wed, Oct 24, 2012 at 12:23 PM, Baishampayan Ghose <[email protected]> wrote:
> What about the technique Clojure uses in the reducers library?
>
> https://github.com/clojure/clojure/blob/master/src/clj/clojure/core/reducers.clj#L37
>
> -BG
>
> On Wed, Oct 24, 2012 at 12:20 PM, Michael Klishin
> <[email protected]> wrote:
>> Is there a way to check if a protocol exists?
>>
>> For example, if I want to extend clojure.data.json protocols but only if it
>> is available, how would I go about it?
>>
>> This way does not work at least some of the time (referenced namespace
>> causes a ClassNotFound exception
>> during compilation):
>>
>> https://github.com/clojurewerkz/support/blob/master/src/clojure/clojurewerkz/support/json.clj#L18-33
>>
>> Any better solutions? I'd like to avoid adding any new dependencies, if
>> possible.
>>
>> Thank you in advance.
>> --
>> MK
>>
>> http://github.com/michaelklishin
>> http://twitter.com/michaelklishin
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to [email protected]
>> Note that posts from new members are moderated - please be patient with your
>> first post.
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>
> --
> Baishampayan Ghose
> b.ghose at gmail.com
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en



-- 
And what is good, Phaedrus,
And what is not good—
Need we ask anyone to tell us these things?

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to