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

You could just let the external methods only access public variables. That's exactly what Java let's you do when you extend another class. I agree that private members should stay private.

I wish I could add methods from outside of my package. I currently run into cyclical dependency issues when I try and define something like...

func (g Game) GetPlayers() []Player { ... }

func (p Player) GetGame() Game { ... }

While having Game and Player in separate packages. It's not the end of the world having them in the same package, but the amount of methods does pile up...



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

Search: