On Fri, Aug 25, 2023 at 7:43 AM محمد بومنذر <mohammed.bu...@gmail.com> wrote: > > I'm writing a parser based on Go's `encoding/xml`, I tried to use the > following pattern but it was deemed invalid: > > ``` > To me, it'd make sense if it was allowed since both types are structs and > both of them share the field `Name` with the subsequent field `Local`.
Please post code as plain text or as a link to the Go playground, not as an image. Images are much harder to read, and there is no reason to use them for plain code. Thanks. We are unlikely to implement such a language feature. We would have to have careful definitions of what kinds of code are permitted in a case with multiple types. And since in general there is no reason to expect that the fields are at the same location, we would have to compile the case differently for each type anyhow. And the code might actually behave quite differently; should we permit code like switch x := v.(type) { case []int, map[int]int: return x[1] } Ian -- 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/CAOyqgcWKCshzVkTTy2hY0YQLk6fU5rdeB%2B_kTbNEhdE_P32%3DHQ%40mail.gmail.com.