On Thu, Oct 18, 2018 at 8:53 AM Robert Engels <reng...@ix.netcom.com> wrote: > > > > > On Oct 18, 2018, at 9:41 AM, Burak Serdar <bser...@ieee.org> wrote: > > > > If X is a struct type, any type implementing all the methods of X and > > containing all the fields of X can be substituted > > The above is the problem. This almost certainly requires dynamic access to > fields, essentially making all method and field access dynamic, and I don’t > think the Go performance hounds will go for it. I am
I don't understand this concern either. func F(in like T) is a template. When the compiler instantiates F with a concrete type T, a new copy of F is compiled using that type. There is no dynamic access involved there, everything is statically resolved. not even certain it can be done without runtime reflection. > > But still a developer having to create a Bar with all of the exported methods > and fields of Foo seems daunting. -- 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. For more options, visit https://groups.google.com/d/optout.