|
|
|
|
|
by pdimitar
1782 days ago
|
|
I'm not sure when did this become about typing systems promising you'll never write tests? IMO nobody says that. Let me give you one example. When I'm coding in Rust and I forget to match on one of my sum type's variants, the compiler will immediately yell at me. When I'm coding in Elixir, the compiler doesn't care if I do exhaustive pattern matching because it doesn't know all possible return values. In these conditions it's extremely easy to not write code that deals with a return value that appears rarely. That's one of the values of static typing for me. |
|
The pattern matching example is one that often comes up talking about typing. Yes it's great that the type checker finds all the places you didn't deal with your new sum type varient...except here's the rub. All that code was working just fine before. Your static type checker is forcing a bunch of code that never needed to know or care about certain values onto all places where you used pattern matching. I don't think this speaks to the value of static typing, I think it suggests that pattern matching is a bad idea that leads to overly coupled code where parts of the system that really shouldn't need to know about each other are now forced to deal with situations they don't care about.