Works, thanks for pointing that out. Now, if only there was documentation mentioning satisfies? and explaining the difference between interfaces/protocols in ClojureScript...
Brendan On Monday, November 24, 2014 3:51:55 PM UTC-5, Francis Avila wrote: > 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
