I'm currently building a project in clojurescript where I need to create 
some macros. And I don't manage to get it to work.
What I'm currently doing is comparable with what you did in core.logic for 
clojurescript: 
https://github.com/clojure/core.logic/tree/master/src/main/clojure/cljs/core/logic

I have create a file src-cljs/jsrefact/macros/macros.clj containing a macro 
defined in clojure.
Aftwards from my project: src-cljs/jsrefact/core.cljs i try to use the 
macrosby putting in de namespace:
(:use-macros [jsrefact.macros.macros :only
                [equals]])

For the compilation I use cljsbuild, and this doesn't give any errors.
But when I try to load the namespace of core.cljs in the REPL it gives this 
error:

java.io.FileNotFoundException: Could not locate 
jsrefact/macros/macros__init.class or jsrefact/macros/macros.clj on 
classpath: 
at clojure.lang.RT.load(RT.java:432)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
...
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
java.io.FileNotFoundException: Could not locate 
jsrefact/macros/macros__init.class or jsrefact/macros/macros.clj on 
classpath: 
nil

I suppose that this error says that the macro file is not compiled but how 
can I solve this?


On Wednesday, September 14, 2011 2:57:16 AM UTC+2, David Nolen wrote:
>
> You can reference macros defined in *clojure* files that are on your 
> classpath like this:
>
> (ns my.namespace
>   (:require-macros [my.macros :as my])
>
> The ClojureScript compiler will use these macros to expand your 
> ClojureScript source.
>
> Works great.
>
> David
>
> On Tue, Sep 13, 2011 at 6:31 PM, Timothy Baldridge 
> <tbald...@gmail.com<javascript:>
> > wrote:
>
>> While working with ClojureScript I came across a interesting question.
>> When compiling cljs files, how does Clojure handle macros? Normally
>> macros are run at compile-time, but in this case the compile-time
>> platform is completely different than the run time platform. My guess
>> is that the compiler assumes that clojure.core.first (for instance)
>> functions exactly the same for both the JVM and the JS versions of
>> Clojure, but I could be wrong there. The only other possibility I can
>> see is if ClojureScript has some internal JS VM it uses only for macro
>> expanding.
>>
>> So what is the situation here?
>>
>> Thanks for your time,
>>
>> Timothy
>>
>> --
>> “One of the main causes of the fall of the Roman Empire was
>> that–lacking zero–they had no way to indicate successful termination
>> of their C programs.”
>> (Robert Firth)
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to