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

I'm amazed nobody is talking about his 'private in' idea.


I did; we can achieve the same functionality through mixins: http://news.ycombinator.com/item?id=4455823


Perhaps someone could explain how it differs and compares to the friend keyword.


It has more to do with layout than with access control. Fields belonging to one class get stored and laid out with another object. They're accessed as part of the other object, but the locks they acquire are for the original object.

I see faint echoes of ruby's open classes if I squint..


Friend only allows others to access your private members. It doesn't allow you to define members in other classes though.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: