I am trying to write a macro that calls cljs code.
How can I use the ClojureScript analyzer to  resolve ClojureScript symbols from 
Clojure?




For example I have:


a cljs namespace 

(ns user.my-cljs)


(defn foo [] 4)

a clj namespace

(ns my-macros)

(defmacro my-macro [] my-cljs/foo)



What is the best way to access my-cljs/foo from inside the macro?



On Saturday, 30 August 2014 20:33:50 UTC+3, Joel Holdbrooks  wrote:
> On Monday, August 25, 2014 1:15:51 PM UTC-7, Yehonathan Sharvit wrote:
> > I would like to write  a macro that calls a cljs function.
> > The problem is that the macro is defined inside a clj file and when I 
> > require the namespace that contains the cljs code I receive the following 
> > compilation error:
> > 
> > 
> > 
> > 
> > Caused by: java.io.FileNotFoundException: Could not locate user__init.class 
> > or user.clj on classpath:
> > 
> > 
> > This is my code snippet:
> > 
> > 
> > (ns cljs_explore.macros
> >   (:require  [user :as user]))
> 
> Can you be a little more clear as to what you are doing? If you are literally 
> trying to call a ClojureScript function from Clojure, it will not work. 
> However, it is possible to resolve ClojureScript symbols from Clojure for the 
> purposes of macro code generation but you'll need to use the ClojureScript 
> analyzer to do this.

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