Re:Golang: How to Update APIs for Generics
by cube2222 on Thursday September 16, 2021 @10:40AM
(#28552415)
Approximating closed sum types is easy already, by creating an interface with a stub private method and implementing it for all variants. Then it's not possible to implement it using a type outside of that package.
The main thing that's lacking is compile time checks whether variant matching is exhaustive.
The main thing that's lacking is compile time checks whether variant matching is exhaustive.