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

I know what you mean; it doesn't [thankfully] happen for complex interfaces, but I maintain that it's useful (OP possibly overstates) as a composition of smaller interfaces. It's completely possible to write a type which satisfies http.ResponseWriter, both technically and in spirit, unintentionally while still being useful.

I've used it around a Stats interface which required a single method: Statistics() map[string]string and have been able to hook up otherwise independent code into a common logger. Speaking of loggers, the fact that the built-in log package doesn't expose an interface has always been an annoyance to me specifically because I can't build my own code and know that it'll satisfy a log.Logger interface in other projects.



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

Search: