Open stapelberg opened 3 months ago
Looking forward to how generics can simplify some of the code in protobufs, where generics could not just “enable metaprogramming” but really provide stronger type safety at compile time. 👍
Adding a bit to this:
there is an additional roadblock to landing this, which is the protodeps indirection package that uses type aliases, which don’t support generics (yet).
I have had luck with type aliases that fold a generic’s type parameter into it. Though, there are still “leaks” here and there, where I run into things like “cannot infer T” when it is otherwise a type parameter of a type it darn well does know. 🤷♀️ And/or simply isn’t used for the particular instance of the generic type.
Splitting this suggestion by @dsnet out of the https://go.dev/cl/607995 review discussion:
I gave this a quick try like so:
There are a number of test failures. The most concerning one probably is:
Needs more investigation. (Inside of Google, there is an additional roadblock to landing this, which is the protodeps indirection package that uses type aliases, which don’t support generics (yet).)