Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Thomas Heller
Hey, not sure what you are trying to achieve, since the compiler should already warn you if a var is not found. Might not do so when nesting defs. def/defn are top level forms und should not be nested, especially no def in a defn. As for your question: the CLJS compiler supports vars in

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Nahuel Greco
Thomas, this is an isolated test, the real case was creating a defmulti macro wrapper and a defmethod one, so in the mydefmulti macro I attach some metadata to the var defmulti defines and then I fetch it in the mydefmethod calls (by using resolve), all in compile-time. This works perfectly in the

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Gary Trakhman
The key is in what you think you mean by 'available at compile-time'. How could this be the case? The macro system has no knowledge of the CLJS compiler internals, and the CLJS compiler does not try to project its state onto the clojure namespace system. However, CLJ macros can return symbols

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Gary Trakhman
The other piece of the puzzle: cljs.core/resolve-var is in a CLJ namespace and uses compiler state: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/core.clj#L681 On Sat, May 31, 2014 at 10:10 AM, Gary Trakhman gary.trakh...@gmail.com wrote: The key is in what you think you

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Nahuel Greco
Gary, maybe I'm misunderstanding you, but cljs.core/resolve-var doesn't contradict your the macro system has no knowledge of the CLJS compiler internals stance? What's the intent of that function (given that trying it in my original example doesn't seems to be capable of resolving the var)? It can

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Gary Trakhman
Why are you bringing the built-in macro env into this? Cljs.core/resolve-var refers to this env: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/env.clj#L39 AFAIK there is no link between them (I could be wrong). On Sat, May 31, 2014 at 10:39 AM, Nahuel Greco ngr...@gmail.com

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Gary Trakhman
We still have to consider that println won't work, even if it is possible to resolve the var, so you'll have to use some other method to see the data: https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/compiler.clj#L897 On Sat, May 31, 2014 at 11:21 AM, Gary Trakhman

[ClojureScript] unit testing with cookies failing security policy

2014-05-31 Thread Paul Lam
I'm writing a wrapper library on goog.net.Cookies and using clojurescript.test for unit testing on Phantom. But I can't manipulate the cookies in the test. It's saying: ``` Testing cljs-cookies.core-test SECURITY_ERR: DOM Exception 18: An attempt was made to break through the security policy

Re: [ClojureScript] are Vars available for macros? Println from macros?

2014-05-31 Thread Nahuel Greco
You already answered the println question, now I'm using spit inside the macro instead of println, let's forget about it. Now the problem is to access CLJS vars at compile time from the macro, not printing them :) The issue seems to be reduced to the question if you can access the CLJS compiler