I am also trying to write a macro but am not able to figure out how to get the clojurescript symbols inside the clj file that I am writing the macros in.
What do I need to :require in my clj file to access js-obj? Regards, Kashyap On Saturday, February 22, 2014 10:21:46 PM UTC+5:30, David Nolen wrote: > Likely a core.async bug. > > > David > > > > On Fri, Feb 21, 2014 at 8:57 PM, Kevin Marolt <[email protected]> wrote: > > On a (possibly) related note: > > > > The #js data literal doesn't seem to work correctly > > inside the go macro as well: Compiling > > > > (go (prn (<! (go (let [bar "bar"] #js {:foo bar}))))) > > > > produces > > > > "WARNING: Use of undeclared Var <ns>/bar ..." > > > > and prints out > > > > "#js {:foo nil}" > > > > if <ns>/bar is nil. > > > > Of course, > > > > (go (prn (<! (go (let [bar "bar"] (js-obj "foo" bar)))))) > > > > works as expected. > > > > > > Am Freitag, 21. Februar 2014 19:07:07 UTC+1 schrieb Jay Lee: > > > > > 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. -- 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.
