Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Jon Bodner
Ah, ok. I think I understand what you're saying. In my opinion, there's a difference between automatically type casting between a concrete type and an interface (or from one concrete type to another) and automatically casting between two compatible (or identical) interfaces. Not automatically

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Constantin Konstantinidis
I understand your concern. What I like a lot in Go is the strong type side that requires strict structure including naming. I'm only pointing that if the compiler cannot "type" a result, it should always mention it. Regards, On Monday, July 4, 2016 at 5:16:57 PM UTC+2, Jon Bodner wrote: > > Hi

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Ian Lance Taylor
On Mon, Jul 4, 2016 at 8:11 AM, Jon Bodner wrote: > > The issue you pointed at is exactly what I'd like to see. > > In my case, I'm providing an interface that matches what's in database/sql > without creating an explicit dependency on database/sql (for cases when > non-sql databases, or non-datab

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Jon Bodner
Hi Constantin, Thanks for responding. This is a case where I think the compiler should be perfectly capable of figuring out that ResultA and ResultB are identical, and allowing one to be substituted for the other. As the adapter shows, the compiler can figure this out when it's a return type,

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Jon Bodner
Hi Ian, The issue you pointed at is exactly what I'd like to see. In my case, I'm providing an interface that matches what's in database/sql without creating an explicit dependency on database/sql (for cases when non-sql databases, or non-databases are used for data storage). I think this is

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-04 Thread Constantin Konstantinidis
It seems to me that the compiling error is adequate guidance. fmt.Printf("%v %T",V.Calculate(2,8)) displays 10 %!T(MISSING) ie Calculate returns a untyped value. If you try to set the type by using the standard interface of type CalcB fmt.Println(ib.Calculate(CalcB(i)).Result()) then the compiling

Re: [go-nuts] Unsure when two interfaces are considered identical

2016-07-03 Thread Ian Lance Taylor
On Sun, Jul 3, 2016 at 12:27 PM, Jon Bodner wrote: > > I'm working on a DAO adapter layer helper called Proteus > (https://github.com/jonbodner/proteus), and ran into an interesting quirk in > what Go considers equivalent interfaces. I recreated a simplified version of > the issue is at https://pl

[go-nuts] Unsure when two interfaces are considered identical

2016-07-03 Thread Jon Bodner
Hello, I'm working on a DAO adapter layer helper called Proteus (https://github.com/jonbodner/proteus), and ran into an interesting quirk in what Go considers equivalent interfaces. I recreated a simplified version of the issue is at https://play.golang.org/p/BS3-bUKtO9 . The code that I linke