News for hackers. Stuff that matters.
Re:Why I like Golang's interfaces by eximius on Thursday April 13, 2017 @10:44AM (#14107359)
Have any go developers run into issues where an interface is satisfied where it shouldn't be due to name conflicts?
Re:Why I like Golang's interfaces by gjem97 on Thursday April 13, 2017 @11:05AM (#14107568)
Technically it happens occasionally, especially if you prefer terse method names and/or small interface definitions. However I have yet to see an example of it causing an issue. Usually I see problems where a struct doesn't satisfy an interface where it "should".
Re:Why I like Golang's interfaces by echlebek on Thursday April 13, 2017 @11:11AM (#14107637)
I've been developing Go apps for 4 years now. So far this has never happened to me. I do agree it's a possibility, if a callee was to do a type assertion or something.
Re:Why I like Golang's interfaces by zellyn on Thursday April 13, 2017 @10:58AM (#14107484)
Not really. Can you describe a situation where accidentally satisfying an unrelated interface would cause a problem?

The worst I can think of are possible developer confusion, and maybe your autocomplete suggesting the wrong thing.

Re:Why I like Golang's interfaces by ryancouto on Thursday April 13, 2017 @10:53AM (#14107437)
what do you mean?
Re:Why I like Golang's interfaces by zellyn on Thursday April 13, 2017 @10:56AM (#14107464)
I think they mean accidentally satisfied interfaces.
Re:Why I like Golang's interfaces by ryancouto on Thursday April 13, 2017 @11:01AM (#14107516)
i was hoping they'd have an example to point to, can't imagine this being a huge problem but i'd be happy to be proven wrong.