4 ms·
Depends what you mean by 'enums' exactly, but now that generics has been added, a small change would be to allow interfaces defined via type disjunction to be u
by foldr 3y ago
Depends what you mean by 'enums' exactly, but now that generics has been added, a small change would be to allow interfaces defined via type disjunction to be used as concrete types:
type Option1 struct { ... }
type Option2 struct { ... }
type MyEnum interface { Option1 | Option2 }
var myValue MyEnum // currently not legal Go
That doesn't solve all the use cases for enums / sum types, but it would be useful.