I could imagine a new kind of interface type specifying fields (not just methods), with the offsets of the corresponding fields in the concrete type stored in the interface's type descriptor.
(I think such a feature would be orthogonal to the current design draft, and could be proposed separately as a followup.) On Wednesday, June 17, 2020 at 8:18:05 PM UTC-4 Ian Lance Taylor wrote: > On Wed, Jun 17, 2020 at 10:05 AM Denis Cheremisov > <denis.ch...@gmail.com> wrote: > > > > I can't get why struct based constraints were banned. struct is a kind > of types in Go and a wish to only allow them having some field is valid. > > I'm not sure I would say that they were banned, it's just that we > haven't seen a good way to fit them into the notion of interface types > as constraints. > > It's not clear how important this is. It's not clear how often this > really comes up in practice. > > 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/77be9fd1-fe38-489b-954e-464a356bf22an%40googlegroups.com.