In ClojureScript these are protocols, not interfaces.

So you instead say (satisfies? cljs.core/IWatchable x)

On Monday, November 24, 2014 12:45:37 PM UTC-6, Brendan Younger wrote:
> Hi all,
> 
> I'm wondering how to check if a given value implements an interface in 
> ClojureScript.  Specifically, I want to know if it implements 
> cljs.core.IWatchable.
> 
> In Clojure (accounting for the different interface name), it would be:
> 
> (instance? clojure.lang.IRef value)
> 
> I've tried this in ClojureScript:
> 
> (instance? cljs.core.IWatchable value)
> 
> but cljs.core.IWatchable is not a constructor function, so it fails.
> 
> Note that I cannot use (instance? Atom value) since my value may not be a 
> ClojureScript atom.
> 
> So far, I've been doing:
> 
> (exists? (aget value "cljs$core$IWatchable$_add_watch$arity$3"))
> 
> but it feels (and looks) like a dirty hack.
> 
> Any suggestions?
> 
> Brendan Younger

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to