by turdprincess · 3y ago · 0 comments
How does immutability or patter matching save me from runtime errors caused by changing the fields or types inside a struct? Wouldn’t the pattern matching just fail and go down the wrong code path since it was matching for the old pattern?
I feel like immutability is great, pattern matching is great, but static typing is also great and there is no reason why it can’t happily live along side the other two.
Elixir structs have compile-time checks: https://elixir-lang.org/getting-started/structs.html