4 ms·
> There is a certain class of errors static types can prevent but there’s a much larger set of those it can’t Maybe you can go into this more, but I don't real
by __jonas 2y ago
> There is a certain class of errors static types can prevent but there’s a much larger set of those it can’t
Maybe you can go into this more, but I don't really understand what that means, what is this larger set of runtime errors that can't be prevented by static typing?
I use a bit of Elixir, and I'd say most of the errors I'm facing at runtime are things like "(FunctionClauseError) no function clause matching", which is not only avoidable in Gleam, but actually impossible to write without dipping into FFI.
I'm excited for more static typing to come into Elixir, as it stands I'm only really confident about my Elixir code when it has good test coverage, and even then I feel uneasy when refactoring. Still a fun language to use though.
- AlchemistCamp 2y agoDepending on the language and the static type system, they typically can't prevent errors related to: - Logic errors - Null or Undefined values (prevented in many newer languages) - Out-of-bounds errors - Concurrency-related issues - Arithmetic errors (undefined operations, integer overflow, etc) - Resource management errors - I/O errors - External system failures - Unhandled exceptions (e.g., RuntimeException in Java) If you use a language like Rust, you can get help from the type system on several of these points, but ultimately there's a limit to what type systems can do before becoming too complex.