I'm building utility macro to convert sequence of functions into javascript 
object in compile time.

What I wanted thing is like as following:

(def-fmap my-funcs
  (test1 [a] (println "t1"))
  (test2 [a] (println "t2")))

--> PLAIN JAVASCRIPT OBJECT
var my-funcs = {"test1" function (a) { console.log("t1"); }
                "test2" function (b) { console.log("t2"); }}

I tried macro which includes #js data literal but 
it didn't work for me.

(defmacro def-fmap
 [n & body]
 (let [fmap (body->func-maps body)]
   `(def n 
         #js ~fmap)
 ))

java.lang.RuntimeException: JavaScript literal must use map or vector notation

So I tried to quote #js literal notation but it was same.

(defmacro def-fmap
 [n & body]
 (let [fmap (body->func-maps body)]
   `(def n 
         ~'#js ~fmap)
 ))

I want to optimize performance for my clojuresciprt
by utilizing macro expansion.

Any tips?

Thanks.




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

Reply via email to