Re:Q1 2018 Funding Announcement
by yorwba on Thursday February 08, 2018 @10:45AM
(#16332842)
By closure compiler, do you mean https://github.com/google/closure-compiler ? Because I don't think it's related to Clojure in any way.
[ Parent
| on HN ]
That's the secret sauce that ClojureScript relies upon for tree shaking, dead code elimination and other optimizations. The Closure library is also used for building blocks of the CLJS runtime.
Sure, but it can be used on all things JavaScript. I guess I'm just confused why it'd be brought up as specific tooling for ClojureScript.
That's actually not true. The Closure compiler has certain restrictions on the Js it accepts for advanced mode compilation, so you can't throw just anything at it.
The advantage is best-in-class dead code elimination, which is also why Closure was chosen; to distill the CLojurescript standard library into just the parts needed for a web page requires good DCE. Recently, other Js projects like Rollup and Webpack have gotten good DCE, but when Clojurescript was started, there were no other serious contenders.
In the context of clojurescript you get 'advanced' optimizations free just by writing clojurescript. In JS you have to buy outside the modern JS ecosystem entirely. The closure compiler doesn't play well with any modern JS tooling, but modern JS tooling is nowhere near as capable at dead-code elimination, minification, and code-rewriting.