I find it a little strange that an interface with a type list can only be used as a constraint, and not as the type of a variable or parameter, despite it using basically the same syntax as a normal interface. Is this difference between constraints and other interfaces a property of the type system, or just a limitation of the translation? I don't think it was explicit in the design document. It would certainly be useful to declare variables with type-list interfaces, as it would provide a much less hacky way to define sum types than using an unexported interface method as in https://medium.com/@haya14busa/sum-union-variant-type-in-go-and-static-check-tool-of-switch-case-handling-3bfc61618b1e.
My failing example is at https://go2goplay.golang.org/p/-lQ0jKs8_hU. -- 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/04b721d6-2ccb-43ab-b73e-399d4fcf22b7o%40googlegroups.com.