News for hackers. Stuff that matters.
Re:Things Go needs more than generics by richardfey on Monday October 04, 2021 @02:12AM (#28743599)
> elides nil checks.

Are you sure? This would only work in a world with a single goroutine.

Re:Things Go needs more than generics by chrisseaton on Monday October 04, 2021 @02:44AM (#28743788)
It’s a basic optimisation. Java does it as well, for example, and it’s safe. But it’s not part of the type system and it’s not what people here are talking about.
Re:Things Go needs more than generics by simiones on Monday October 04, 2021 @07:55AM (#28745552)
It's more complex in practice, since you need to also check that the compiler needs to see the entire lifetime of the variable to check if it's not modified asynchronously, as you say. But for many common use cases, this is not hard to confirm, especially since the Go compiler has access to the entire source code of the entire program (unlike in C++, Java, etc).