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

Ruby is actually more conservative on this issue, it isn't possible to make fields public. The attr_accessor macro is actually adding getters and setters. The implementions used for the getters and setters are equivalent to those that you would write in java. As mentioned elsewhere you can switch in custom implementations as required but, as in java, the majority of the time the default implementations are sufficient. The difference is that it in ruby you don't need to write the getters and setters until you need the customisation.


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

Search: