Hacker News new | ask | show | jobs
by izgzhen 1762 days ago
Golang doesn’t have a proper generics support at its beginning. It is too late now.
1 comments

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