4 ms·
It doesn't have anything to do with implementation details, even though the weird set of rules from the article implies that. Dump those rules for a much simpl
by slrz 8y ago
It doesn't have anything to do with implementation details, even though the weird set of rules from the article implies that.
Dump those rules for a much simpler insight:
When comparing interfaces, type and value must match to compare equal.
So, (nil, nil) compares NE to (*myFancyErrorType, nil) for the same reason that (float64, 0) and (uint16, 0) do.
It isn't all that complicated. I don't see a real and non-insane alternative to it. Do you?
- Groxx 8y agoSure there is. Do what the vast majority of other languages do - don't bundle behavior and nil like this. Or even better, make nullability a proper first-class citizen so this nonsense can be prevented at compile time.