4 ms·
I don't like your definition of "implicit nullability". Following that logic, Java integers can't be null either, and C has no implicit nullability! In practice
by creata 6y ago
I don't like your definition of "implicit nullability". Following that logic, Java integers can't be null either, and C has no implicit nullability! In practice, when we say we don't want implicit nullability, we mean that we want nonnullable everything, including pointers. After all, Tony Hoare called null references his billion dollar mistake.
- coder543 6y agoThat's not implicit nullability, in my opinion. I agree that non-nullable references are wonderful, and Go will probably have to grapple with that eventually. I just don't want people to get the wrong idea. Go has value types -- not everything is a reference that is implicitly nullable. C isn't implicitly nullable, you are correct.
- creata 6y agoI feel like we're just using different definitions of implicit nullability, and by your definition, no language with value types is implicitly nullable, whereas by my definition, every language without nullable references is implicitly nullable. I think your definition is bad and uncommon, but that's not a very fruitful line of discussion.
- coder543 6y agoYou're referring to how some languages have non-nullable references, which is fine. That's probably a better term to be using, since it is more clearly defined and less contentious in this discussion. I agree that Go should consider adopting non-nullable references.
- cies 6y agoIf I return a struct pointer in C, I can also return null. The return type does not communicate this to me: this is what I call implicit nullability. It is just a bad contract, as it is often misunderstood, and it allow for runtime errors that could easily have been caught at compile time.