2 ms·
And how do you think that solves the problem? Consider: func foo() error With the programmer forgetting to handle the error: foo() Now imagine that Go
by randomdata 3y ago
And how do you think that solves the problem? Consider:
func foo() error
With the programmer forgetting to handle the error:
foo()
Now imagine that Go received some kind of hypothetical Result type. The foo function is updated to use it:
func foo() Result[error]
But the problem remains. The compiler still isn't going to tell you that you forgot to handle the error.
- vacuity 3y agoSo you're saying the programmer forgets to use the return value at all. There are linters, documentation, and basic common sense. This is not at all a relevant issue, or else there are serious issues with the programs you see. Why are you discussing whether Go's error handling needs improvement if your imagined programmer can't even program? Well, I've spent enough time on this thread.
- deleted 3y ago[deleted]
- randomdata 3y ago> So you're saying the programmer forgets to use the return value at all. That's what the original commenter said. Logically, how else could you forget to handle the error? The compiler will bitch and moan if you do capture the result and then don't do anything with it. You did take the time to read the thread before replying, yes? > This is not at all a relevant issue It must be, else how do you explain the many comments you wrote trying to explain how sum types solves the problem? Even while I continually told you they don't. > Why are you discussing whether Go's error handling needs improvement if your imagined programmer can't even program? I said that it doesn't need improvement because in practice your tests will catch the problem immediately anyway. I even said that it is probably fundamentally impossible for there to be technical solution to the problem. And the rest of the time was telling you that sum types cannot solve the problem, despite your constant urging. I am still not clear how you think sum types solve the problem. > Well, I've spent enough time on this thread. Are you sure you spent any time on this thread?