3 ms·
Programs written in ML dialects tend to have the astounding property that once they compile, they are correct. And this is only a slight exaggeration. This pro
by fsloth 8y ago
Programs written in ML dialects tend to have the astounding property that once they compile, they are correct. And this is only a slight exaggeration.
This property alone is worthwhile to learn one, if for nothing else then to be able to apply the same succesfull patterns in other languages.
I didn't know how to write proper strongly typed code until I learnt Ocaml - I had several years of experience in C++ and knew Java, but, they really don't go out of their way to expose the patterns that allow write the best code possible. With the lens of Ocaml under my belt I could better discern the shiny patterns that were buried all that ugly dirt of multiple inheritance and such bollocks.
Which ML language should you learn? Any of them is good as the next if it's for education - a modern tooling, support and community is a nice bonus.
ML languages in production nowadays include Ocaml, F# and, to some extent given it has so much isomorphism with its kin, Scala. Scala can be considered an ML dialect, although with the weirdest syntax of them all.
Unless you are quite certain Ocaml is the exact language you want to learn, F# is a good alternative.
- owl57 8y agoI'd say Elm is a plausible alternative, though maybe not right now: there are a lot of small rough edges in the ecosystem after 0.19 release. On the other hand, a lot of the 0.x breakage comes from the very high priority of the unusual long-term plan, which I'd formulate as something like following: distill that essential property of ML while shaving all the bells and whistles that just happen to be in other dialects.
- fsloth 8y agoAre there any plans to bring Elm to any non-javascript runtime?
- owl57 8y agoLong term: yes, the controversial banning of "native" code [1] is in part motivated by the idea that JS should be an interchangeable implementation detail. Short term, officially: hell no, Evan declares a sharp focus on one use-case and discourages experiments with other platforms, even server-side node.js [2]. Short term, unofficially: I heard of a compiler to Elixir [3]. Elm's stance on "native code" (see above) seems to make such projects feasible. [1] https://discourse.elm-lang.org/t/native-code-in-0-19/826 https://discourse.elm-lang.org/t/native-code-in-0-19/826 [2] https://github.com/elm/projects/blob/master/roadmap.md#can-i-use-elm-on-servers https://github.com/elm/projects/blob/master/roadmap.md#can-i... [3] https://github.com/wende/elchemy https://github.com/wende/elchemy