3 ms·
OCaml isn’t pure. Elm will not support mutations, exceptions or unmanaged side effects. This makes it easier to reason about code, even code that you didn’t wri
by Skinney 2y ago
OCaml isn’t pure. Elm will not support mutations, exceptions or unmanaged side effects. This makes it easier to reason about code, even code that you didn’t write yourself.
- fire_lake 2y agoI think that Elm has divide by zero exceptions? My main worry about pure functional languages is that you are at the mercy of the compiler for optimization - for better or for worse. In OCaml or F# I can hand-write things in an imperative way on hot paths. This still doesn’t prevent OCaml from having great optimization passes.
- Skinney 2y ago> I think that Elm has divide by zero exceptions? Elm numbers are JavaScript numbers, so divide by zero returns NaN, it doesn't crash. Although there are other instances that definetly can crash your program, Elm code doesn't allow you to throw or catch exceptions as a language feature. > My main worry about pure functional languages is that you are at the mercy of the compiler for optimization It's a scale. There are many ways to optimize outside of using mutation, and allowing for imperative code does prevent certain kinds of optimizations. In general though, the trade off with a language like Gren is that you value correctness and readability more than performance. For me, for the sort of projects I work on, I've never hit an unsolvable performance problem with a pure language. Your milage may vary.