Hi David,
This has been very helpful in understanding the internals of the ClojureScript
compiler and I found it fascinating. Much appreciated.
I am having a bit of trouble understanding the syntax of the user environment
map. Is there documentation for this? My goal is to specify multiple requires
and multiple locals.
You have defined it as:
(def user-env '{:ns {:name cljs.user} :locals {}})
I have your code running happily in Light Table and I have pasted the following
code at the end:
(let [form (read1 "(fn [a b] (+ a b x handler/y hand/z))")]
(with-out-str (c/emit (ana/analyze user-env form))))
This evaluates to:
"(function (a,b){return ((((a + b) + cljs.user.x) + handler.y) +
hand.z);\r\n});\r\n"
Now, I want to find a way of altering the environment to something like:
(def user-env '{:ns {:name cljs.user :require [[compojure.handler :as hand]]}
:locals {:name x}})
I am only showing one require and one local in this example but the result I
would be hoping for is:
"(function (a,b){return ((((a + b) + x) + handler.y) +
compojure.handler.z);\r\n});\r\n"
Notice that because handler/y would just compile to handler.y since there is no
specific info on what to do in the environment.
When I evaluate using my environment, the JavaScript doesn't change, so what am
I doing wrong? Is what I want even possible?
Many thanks,
Gregg.
On Wednesday, 15 January 2014 23:44:06 UTC+10, David Nolen wrote:
> I've started what I hope will be a collaborative and comprehensive reference
> on the ClojureScript language for people looking to extend Light Table. This
> is a file that can be directly evaluated in the Light Table UI Connection.
> http://swannodette.github.io/2014/01/15/clojurescript-for-light-table-users/
>
>
>
>
> I hope it inspires people to put together similar interactive guides on Light
> Table specific functionality.
>
>
> David
--
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.