5 ms·
> doesn't run against the grain of the entire language Not an expert, but my gut says maybe it runs against zero values? As in, "what's the zero value for a no
by mrgriffin 2y ago
> doesn't run against the grain of the entire language
Not an expert, but my gut says maybe it runs against zero values? As in, "what's the zero value for a non-nullable reference?" Maybe the answer is something like "you can only use this type for parameters", but that seems very limiting.
- rudiksz 2y agoHalf of the language is already non-nullable and is accomplished by allowing for zero values. Non pointer variables are guaranteed to be never nil. What is missing is the ability to have pointer variables and have the compiler ensure that it will be never nil. I believe this was a design choice, not some technical limitation.
- keybored 2y agoLike the sibling comment seems to be saying: a non-nil pointer would have to be set to some real (non-nil) pointer value anyway. So having a zero value does not seem to apply?