Hello,
I'm working on a clojurescript project which uses XState javascript
library. XState is a state chart and final state machine library which I'm
trying to adopt to work alongside re-frame. I define state chart transition
actions using clojurescript and pass them to javascript world. Recently
I've stumbled over a situation that I can't pass a function from
clojurescript to XState/javascript if the function have metadata attached.
Javascript code can't invoke such a function, because it's not a javascript
funciton anymore, but a clojurescript entity implementing IFn protocol. The
reason is that the result of
(with-meta (fn [x]...))
doesn't return a function which external javascript code can call, but an
object of cljs.core/MetaFn type, which I think is against (with-meta)
contract.
with-meta documentation says:
> cljs.core/with-meta
> [o meta]
> Returns an object of the same type and value as obj, with
> map m as its metadata.
>
So I expect the object of the same type, such that
(= (type #()) (type (with-meta #() {:a :b})))
holds, as well as
(= true (instance? js/Function (with-meta #() {:a :b})))
So the question is, have I found a bug?
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/clojurescript/e653965f-0277-470e-8ea0-926681f743a6%40googlegroups.com.