Re:Go Developer Survey 2022 Q2 Results
by nemothekid on Thursday September 08, 2022 @01:12PM
(#32768510)
A real problem is when something like this occurs
unless you explicitly ignore `err`, the compiler shouldn't allow you to use `x` without checking err. In Rust/Zig this is accomplished with the union types, which doesn't allow to use `x` until you have checked it's not an error. This is also very useful for Option types; and I wish it was in Go since the beginning as having `nil` in the language is a huge mistake.
[ Parent
| on HN ]
The problem is worst with procedural functions
os.Mkdir("foo")
looks pretty innocent but with no return value to use, the compiler is no help in reminding you this is a fallible function