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

the purpose is to not be able to use the interface outside the module, right? why wouldn't you just use an interface type with a lowercase name, which wouldn't be visible outside the module?


You want to be able to use the interface outside the module, but not allow anyone else to implement that interface.


The purpose was to not allow defining types which satisfy the interface outside the package. In this case they still want others to be able to use the values of the interface.

It's an uncommon thing to need to do, but this example shows that you can do it.




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

Search: