Re: [go-nuts] Resolving type ambiguity w/ functions that return an interface

2021-02-28 Thread 'Axel Wagner' via golang-nuts
On Sun, Feb 28, 2021 at 4:03 AM Deiter wrote: > My (clearly flawed) interpretation of interface types suggested that I > could assign the first result from c.StdoutPipe() to anything that > implements io.ReadCloser. > To try and explain the flaw in the argument: These two statements are

Re: [go-nuts] Resolving type ambiguity w/ functions that return an interface

2021-02-27 Thread Ian Lance Taylor
On Sat, Feb 27, 2021 at 7:03 PM Deiter wrote: > > Go: go1.15.8 darwin/amd64 > OS: MacOS 11.2.1 > > It makes sense to me that a function can have arguments that are interfaces - > so long as the argument provides the methods that the function requires, it > will be happy. However, I’m having a

[go-nuts] Resolving type ambiguity w/ functions that return an interface

2021-02-27 Thread Deiter
Go: go1.15.8 darwin/amd64 OS: MacOS 11.2.1 It makes sense to me that a function can have arguments that are interfaces - so long as the argument provides the methods that the function requires, it will be happy. However, I’m having a difficult time understanding functions that return an