[CLJS-1059] Simple interface wanted to convert cljs forms to js Created: 22/Feb/15 Updated: 31/Jan/16
We would like something similar to closure/compile-form-seq (https://github.com/clojure/clojurescript/blob/master/src/clj/cljs/closure.clj#L308)
However, we need to supply, the namespace requires and locals in an env like this
This code seems to do what we want.
I am not sure why I need env/ensure.
Would you be able to patch compile-form-seq to provide the needed interface, or suggest what we should be doing.
|Comment by Mike Thompson [ 22/Feb/15 10:09 PM ]|
Just to be clear:
To satisfy point 4, our tool extracts all the 'locals' from the current call-frame, and then supplies all these local bindings in env/locals, so the compiler doesn't stick a namespace on the front of them.
Our method to achieve this is to put 'x' into env/locals when compiling – and it all works. Except, with the recent changes this has become more of a challenge. Hence this ticket asking for a way to pass in env.
|Comment by Thomas Heller [ 23/Feb/15 3:19 AM ]|
You could wrap the user expression in an fn, that would allow you to skip messing with the locals. The REPL basically does the same trick for *1,*2,...
|Comment by David Nolen [ 29/Apr/15 7:21 AM ]|
Seems like something useful to add to a cljs.compiler.api namespace.