Re:JavaScript Modularity Shaming
by nostrademons on Wednesday January 07, 2015 @06:17PM
(#8853978)
Closure also has a goog.scope call that lets you locally alias various imports, but the compiler is aware of it and can optimize across scope boundaries. Pretty handy - besides dead-code elimination, variable renaming also works with goog.scope and so you don't have to treat each import as an extern and spell out the fully-qualified name in the generated code.
This surprisingly makes ClojureScript really nice for developing with the Closure Library (not that using any library that depends on mutable objects is particularly nice in Clojure), because you can write code like the following, and still benefit from dead code elimination:
The Closure Library is impractical without dead code elimination because it includes so much functionality, and is not meant to be used as a single script dependency.