Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think this is really a problem that exists beyond interfaces. For example, even if you had these two concrete types, and both had close methods, how would you know when to call one close versus another and what they do? This kind of confusion is a perpetual problem... and I don't think Go interfaces make it any worse, really.


I would know because the concrete types formally reference an interface, and the documentation of the interface would tell me more about the intended semantics.

You're right that simply having this formal reference doesn't solve all problems that could possibly arise. But there's one form of confusion that is much less likely to arise.

As is so often the case, more flexibility comes with more opportunity for screw-ups.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: