On Thu, Oct 18, 2018 at 8:53 AM Robert Engels <[email protected]> wrote:
>
>
>
> > On Oct 18, 2018, at 9:41 AM, Burak Serdar <[email protected]> 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 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.
That is not intended for copy paste. That is intended for the following case:
type S struct {
blah...
}
func (s S) F() { ... }
func W(in like S) {
}
type K struct {
S
}
You can call W(K{})
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.