Hi all,

I'm toying with a way to use Clojure objects from a Rhino-based
ClojureScript environment (https://github.com/harto/rhino-bridge).

I've been able to export a Clojure function into the ClojureScript
environment without too much difficulty. Ideally, I'd like to be able to
call that function as if it were a regular ClojureScript function.

I was hoping I could do something like:

(extend-type js/Packages.clojure.lang.IFn
  IFn
  (-invoke [this] (.invoke this))
  (-invoke [this a] (.invoke this a))
  ;; etc
  )

However, this yields an error that I don't quite understand:

java.lang.UnsupportedOperationException: nth not supported on this type:
Symbol
    at clojure.lang.RT.nthFrom(RT.java:846)
    at clojure.lang.RT.nth(RT.java:796)
    at
cljs.core$extend_type$assign_impls__7365$fn__7377$adapt_params__7380.invoke(core.clj:486)
    at clojure.core$map$fn__4087.invoke(core.clj:2434)

In fact, I'm not sure this will work at all, since (type) doesn't appear to
work with non-native JS objects.

Is the extend-type method feasible?

Cheers,
Stuart

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