4 ms·
Elm is a very good example of a compiler, but (as I recall, unfortunately without information in front of me) it's not that great of an example of doing maximal
by kylecordes 9y ago
Elm is a very good example of a compiler, but (as I recall, unfortunately without information in front of me) it's not that great of an example of doing maximal work at compile time to minimize the size of a runtime support library. I don't remember the kilobytes but they are significant.
That said though, since the Elm language is nicely constrained, it seems possible that a future version of the compiler could keep moving quite far in this direction.
- zachrose 9y agoThe latest thought on this from the Elm community is that dead code elimination should be done after compilation[1] and that this should be easy[2]. I don't think the OP's main point was about file size optimization though. Elm's killer "optimization" is to remove the mutable parts of JavaScript and add a strong type system that can prevent practically all runtime errors. To achieve that goal the source language is significantly different than the target language. [1]https://github.com/elm-lang/elm-compiler/issues/1453#issuecomment-236917961 https://github.com/elm-lang/elm-compiler/issues/1453#issueco... [2] https://github.com/elm-lang/elm-make/issues/91#issuecomment-205984891 https://github.com/elm-lang/elm-make/issues/91#issuecomment-...