Frederik Zipp schrieb am Dienstag, 18. August 2020 um 19:44:05 UTC+2: > I agree it is a weird combination. Ideally it would be: > > 1. `anyof` declarations containing only types, usable as constraints and > types > 2. `interface` declarations containing only methods, usable as constraints > and types > 3. n/a > > But then Go would introduce both generics and sum types at the same time, > which does not seem to be feasible due to unsolved questions like the > zero-value issue. >
Of course, it would be possible to allow usage of `anyof`s only as constraints, with the option to allow them as general types in the future. The cost is a new keyword, though. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/afb4ebed-25a4-456a-93b1-1a891b322343n%40googlegroups.com.