[go-nuts] Re: Sharing similar Interfaces across packages

2016-09-25 Thread question . developer
But unfortunately that would mean changing the public interface of Two.Item. Which is not desired (but that wasn't specified explicitly in the example given). On Sunday, September 25, 2016 at 3:22:57 AM UTC-7, question@gmail.com wrote: > > The interface for One.Item is expecting a One.Ite

[go-nuts] Re: Sharing similar Interfaces across packages

2016-09-25 Thread question . developer
The interface for One.Item is expecting a One.Item as an argument to its Less() method. By embedding it in Two.Item, that shouldn't change that correct? So the resulting public interface for Two.Item *after embedding* One.Item is technically. type Item interface { Less(One.Item) bool Le

[go-nuts] Re: Sharing similar Interfaces across packages

2016-09-25 Thread Tamás Gulácsi
An interface is not a class, but the contract of minimal provided methods: as Two has more methods, anything implements a two.Item will also implement one.Item. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Sharing similar Interfaces across packages

2016-09-24 Thread question . developer
Wouldn't then the argument being passed into Less(Item) and Swap(Item) be for two different interfaces? One.Item for Less() and Two.Item for Swap(). On Saturday, September 24, 2016 at 10:31:56 PM UTC-7, Tamás Gulácsi wrote: > > You can embed the interface in two.Item: > type Item interface { >

[go-nuts] Re: Sharing similar Interfaces across packages

2016-09-24 Thread question . developer
Wouldn't then the argument being passed into Less(Item) and Swap(Item) be for two different Items? One.Item for Less() and Two.Item for Swap(). On Saturday, September 24, 2016 at 10:31:56 PM UTC-7, Tamás Gulácsi wrote: > > You can embed the interface in two.Item: > type Item interface { >