News for hackers. Stuff that matters.
Re:Elm and Phoenix/Elixir in Production for France TV by hellofunk on Sunday October 16, 2016 @10:33AM (#12718753)
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.
Re:Elm and Phoenix/Elixir in Production for France TV by Skinney on Sunday October 16, 2016 @02:04PM (#12719950)
The 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.
Re:Elm and Phoenix/Elixir in Production for France TV by hellofunk on Sunday October 16, 2016 @02:48PM (#12720236)
Dead code elimination is only part of the benefits of Closure. The advanced compilation mode does a lot to optimize the final JS.
Re:Elm and Phoenix/Elixir in Production for France TV by bjz_ on Sunday October 16, 2016 @04:34PM (#12720784)
I 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.
Re:Elm and Phoenix/Elixir in Production for France TV by hellofunk on Sunday October 16, 2016 @05:55PM (#12721212)
That's because Elm does not output JavaScript in the standardized format for Closure.
Re:Elm and Phoenix/Elixir in Production for France TV by Skinney on Monday October 17, 2016 @07:45AM (#12724182)
Closure 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.
Re:Elm and Phoenix/Elixir in Production for France TV by danenania on Sunday October 16, 2016 @01:36PM (#12719776)
I 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.

Re:Elm and Phoenix/Elixir in Production for France TV by smnplk on Sunday October 16, 2016 @05:11PM (#12720978)
Do you know about cljs-js ? https://github.com/cljsjs/packages
Re:Elm and Phoenix/Elixir in Production for France TV by danenania on Sunday October 16, 2016 @06:21PM (#12721361)
Nope, I hadn't seen that. Definitely helps!
Re:Elm and Phoenix/Elixir in Production for France TV by hellofunk on Sunday October 16, 2016 @02:47PM (#12720226)
Closure's advanced compilation mode really optimizes the final JS, no?
Re:Elm and Phoenix/Elixir in Production for France TV by pdamoc on Monday October 17, 2016 @10:16AM (#12725185)
Elm 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.