Hi there,

I have a macro for use in cljs that injects code to make a function call to 
a function in a cljs namespace.  Now when I use that macro I have to 
:require the corresponding cljs namespace or during compilation I am 
flooded with superfluous: "WARNING: Use of undeclared Var 
mycljsnamespace/func at line ...." messages.

Is there a way to make the use of the macro in a cljs namespace add the 
cljs require statement to ensure that these warnings are suppressed?

The function call in the macro is here: 
https://github.com/infinitelives/infinitelives.pixi/blob/master/src/clj/infinitelives/pixi/macros.clj#L36

and when using it, the compilation looks like:

WARNING: Use of undeclared Var infinitelives.pixi.canvas/get-default-canvas 
at line 15 src/cljs/...
WARNING: Use of undeclared Var infinitelives.pixi.canvas/get-default-canvas 
at line 15 src/cljs/...
WARNING: Use of undeclared Var infinitelives.pixi.canvas/get-default-canvas 
at line 11 src/cljs/...
...

at this stage in my present project its at least 50 lines of these.

if I require that name space in the client code that warning disappears but 
that requires the user of the macro to know that in advance, and be 
disciplined enough to do it.

How do I *auto require* the namespace, when the macro is used?

I found this thread from 2013: 
https://groups.google.com/forum/#!searchin/clojurescript/require$20in$20macro%7Csort:relevance/clojurescript/FNwwN87B2EE/lLF-Tel977AJ

In it, Jozef Wagner states: "AFAIK there is no way to do this automatically"

Is this still the case?

I see CLJS has supported since 1.9.293 : CLJS-1346: Support require outside 
of ns

Can I make the macro inject the require into its output code so the 
"WARNING: Use of undeclared Var" is not emmitted?

I have experimented with this but have been unable to make it work.

Is this possible to do? If so, how can this be done?

Regards

Crispin

-- 
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 https://groups.google.com/group/clojurescript.

Reply via email to