3 ms·
At the very least, Elm code should be compatible with Google's Closure compiler (just like Clojurescript). There is no reason the Elm folks should try to re-inv
by hellofunk 10y ago
At the very least, Elm code should be compatible with Google's Closure compiler (just like Clojurescript). There is no reason the Elm folks should try to re-invent the wheel on this, just harness the power of the Closure utilities by making your emitted JS standardized and compliant. Then you get all sorts of things for free, like dead code elimination, just for starters. The Clojure team realized this from the start and it has done a lot for the cljs ecosystem.
- danenania 10y agoI disagree. Google Closure is antiquated and complicated to configure and adds a lot of unpleasant baggage to cljs. I love Clojurescript as a language, but using it alongside existing js libraries is awkward and error-prone, and getting the build process to work smoothly takes way more time than it should. Cljs gets a lot right too, but it shouldn't be held up as an example in this regard.
- Skinney 10y agoThe way Elm outputs JS today, it doesn't really have much to gain from being Closure compliant. Even uglify manages to remove most dead code from an Elm "blob", because Elm outputs javascript with a single scope. An Elm app is smaller than both a Cljs+React(om, reagent) and a JS+React app.
- hellofunk 10y agoDead code elimination is only part of the benefits of Closure. The advanced compilation mode does a lot to optimize the final JS.
- bjz_ 10y agoI haven't had much luck the the advanced setting for Elm - seems to optimise too much away, and I get undefined field errors when I try to run the code.
- hellofunk 10y agoThat's because Elm does not output JavaScript in the standardized format for Closure.
- Skinney 10y agoClosure doesn't really have a standardized format. It does, however, not like that you mix string and dot access for object (obj['str'] vs obj.str), which Elm does a couple of places.
- pdamoc 10y agoElm compiler knows more about the code than Closure compiler. It can safely remove more and do a bunch of other optimizations facilitated by the types. There was a DCE branch at one point but it never got finished.