6 ms·
Golang doesn’t have a proper generics support at its beginning. It is too late now.
by izgzhen 5y ago
Golang doesn’t have a proper generics support at its beginning. It is too late now.
- masklinn 5y agoYou don't even need generics to avoid nullable pointers, you can special-case it as they special-cased slices, maps, channels, etc… e.g. `*int` -> non-nullable pointer to int; `?int` -> nullable pointer to int, and a tiny bit of flow analysis in nil checks so e.g. `if foo != nil` implicitly creates a new non-nullable version of `foo` inside the block body.