3 ms·
> Nil is useful, as long as correctly reined in. A good way to rein in behaviour is with types. If you need Nil in your domain, great! Give it type 'Nil'.
by mrkeen 3y ago
> Nil is useful, as long as correctly reined in.
A good way to rein in behaviour is with types. If you need Nil in your domain, great! Give it type 'Nil'.
- aatd86 3y agoYes that's part of it. It will probably require a nil type which is currently untyped nil when found in interfaces. The untyped nil type is just not a first-class citizen nowadays. But with type sets, we could probably have ways to track nillables at the type system level through type assertions. And where nillables are required such as map values it would be feasible to create some from non nillables then ( interface{T | nil}) But that's way ahead still.
- deleted 3y ago[deleted]