Hacker News new | past | comments | ask | show | jobs | submit login

> 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'.




Yes 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: