InfoQ Homepage Presentations ClojureScript Anatomy
ClojureScript Anatomy
Summary
Michael Fogus discusses the internal workings of ClojureScript, how it analyzes and compiles Clojure code to JavaScript.
Bio
Michael Fogus is a programmer with experience in machine vision, expert systems, and distributed simulation. He is co-author of "The Joy of Clojure" and author of "The Art of Chupacabra Husbandry".
About the conference
Clojure/West is a new conference bringing the Clojure community together to discuss techniques, tools, and the state of the Clojure ecosystem March 16-17th for three tracks of sessions. Prior to the conference, register for three days of training by the Clojure experts.
Community comments
very confusing
by Brian Craft,
very confusing
by Brian Craft,
Your message is awaiting moderation. Thank you for participating in the discussion.
So much incorrect information in this video, I wonder if I'm misunderstanding him. Crockford's functional inheritance pattern has exactly nothing to do with modifying prototypes of native objects. It's completely unrelated. In contrast, adding munged names to Object.prototype is absolutely not safe. If clojurescript is actually doing this, it will break other libraries.
Contra Fogus, globals are a much, much bigger problem in clojure than in javascript. Having programmed in javascript for many years, the only library I've ever seen that relied on globals is flapjax, which apparently did so as a result of using Google Closure w/o specifying a namespace (go Google!). In contrast, many clojure libraries are built on globals: have fun when you need to, say, talk to two databases: the db param is a global. The community has adopted an anti-pattern of keeping an implicit context in a global, hidden by macros, apparently on the theory that globals don't exist if you can't see them. It's become so prevalent that Stuart Sierra raised the issue at Clojure/West this year. So, again contra Fogus, convention is more powerful than tooling, and there's nothing "sinister" about using a tool well instead of badly.
Regarding the "slice thing", I wonder how anyone could use javascript for more than a week or two and then forget how to apply a method to an object.