Re:Elixir 1.17 released: set-theoretic types in patterns, du...
by throwawaymaths on Thursday June 13, 2024 @05:52PM
(#40675251)
exactly. The potential performance regression of guards is exactly why the elixir typechecker doesn't insert them. I guess I hadn't made that point clear in my comment. IIRC The elixir guides talks about excessive typechecking being a code smell.
For instance, without even introducing annotations, if a function head has a guard `is_boolean(x)`, using the + operator on x within that function would lead to a type error.