4 ms·
I think the reason is the discrepancy between what you're saying (which is true) and reality: > sometimes you have to represent 'nothing.' Languages in which
by TotempaaltJ 6y ago
I think the reason is the discrepancy between what you're saying (which is true) and reality:
> sometimes you have to represent 'nothing.'
Languages in which all values can /also/ be null break the "sometimes" requirement there. Not all variables/parameters should be able to represent nothing. Representing nothing isn't the issue here, I doubt anyone disagrees that that's useful (there are still Options). The fact that anything can be nothing is.
- hehetrthrthrjn 6y agoI get that, but the solution is not "enforce it with static type checking", especially when the default is non-nullable. In my experience nullability is a dynamic constraint and it's most often just passed through various functions, until it becomes an issue some function. Static null checking then just becomes madness. Other representable values can also can be invalid inputs to some code, but we don't implement draconian constraints throughout the code to manage that.