3 ms·
> A pointer can be nil, which is obvious It's certainly common, but of the things which would be useful to be able to constrain only to allow explicit and non-
by dragonwriter 6y ago
> A pointer can be nil, which is obvious
It's certainly common, but of the things which would be useful to be able to constrain only to allow explicit and non-default nillability, pointers are pretty high on the list.
- andreygrehov 6y agoWhat would be a better design?
- dragonwriter 6y agoStatically requiring a (the default case) non-nillable pointer to be assigned to a non-nil value (presumably, ultimately as a result of an operation that fails if it can't allocate, or one that either fails or returns a non-nil pointer when passed a nillable pointer) before being used? The same thing as is done for any other non-nullable value in static type systems.