3 ms·
I loosely read it as both: Using cmp.Or does not short-circuit evaluation. The other bit was also interesting: > According to the proposal, the built in const
by karmakaze 3y ago
I loosely read it as both: Using cmp.Or does not short-circuit evaluation.
The other bit was also interesting:
> According to the proposal, the built in constant `zero` would be available in generic functions for return or comparison. However, after the proposal was accepted, it was retracted due to continued community push back against the idea of having both `nil` and `zero` in the language.
So instead of having a `zero` we have many zeroes `nil`, 0, `""`, etc. Go really eschews abstractions.
- anamax 3y agoLots of zeros is good. One big problem with null pointers is that there's only one of them. (One of a given type doesn't help.) Hoare's "NULL was my biggest mistake" rant proposed the wrong solution, namely no null.
- earthboundkid 3y agoI think it would be better if Go had nilptr for pointer types and "nil" only applied to interface types. That would fix the problem of "why did I return nilptr but the value != nil?" But Go should also have a named zero value that applies everywhere, or at least an operator like ? that compares anything to zero.