3 ms·
The caller can check if the result != nil. If I get a result that came with a non-nil error, and I still plan to do something with the result, then it seems na
by beautron 3y ago
The caller can check if the result != nil.
If I get a result that came with a non-nil error, and I still plan to do something with the result, then it seems natural to think about the possibility that the result might be nil. I would consult the function's documentation, and maybe its source, and then maybe put in a nil check.
This is too rare a problem to be worth adding complexity to the language. There needs to be a big payoff for adding complexity. A language gets hard to use if it adds micro-complexities all over the place for the sake of preventing rare programming mistakes.