Re:Golang: How to Update APIs for Generics
by xyzzy_plugh on Thursday September 16, 2021 @12:01AM
(#28547844)
Certainly this is true, but I wouldn't put it past rsc & co to find some magical incantation that provides full backwards compatibility. In particular the alias keyword was quite succinct and not abused much.
Re:Golang: How to Update APIs for Generics
by tikkabhuna on Thursday September 16, 2021 @04:09AM
(#28549265)
Sounds like a nightmare for newbies getting started. If this is the way forward, and I agree its the most Go-like, I would like to see good support for warning users to use v2 and why they need to.
Re:Golang: How to Update APIs for Generics
by YesThatTom2 on Thursday September 16, 2021 @06:40AM
(#28550055)
Quite the opposite. Naive users will not be affected. They’ll just use generics and not realize that for certain types the code generated is more specific.
Or are you assuming newbies read the standard library source?
Re:Golang: How to Update APIs for Generics
by nirui on Thursday September 16, 2021 @11:05AM
(#28552725)
I don't think it would be that easy.
Think how the maintainers of third-party package will maintain their package after this: before, they just need to target the one and only `atomic` (or any other package mentioned in the GitHub discussion), now they might have to target both `atomic` and `atomic/v2` just to support generics.
I really hope they could come up a cleaner solution than this.
Re:Golang: How to Update APIs for Generics
by bradleyankrom on Thursday September 16, 2021 @08:14AM
(#28550751)
I know a lot of “get started with Go” blog posts, books, etc recommend going through the standard library code to see conventions in practice. Go’s stdlib is relatively easy to read, especially if the consumer has some previous experience with other languages.
Use new major versions for stdlib packages, e.g., sort/v2