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

I don't understand why public fields need the underscore prefix. Aren't all fields public by default? Why do you need to add a prefix to "hide" public fields?


They don't, that's just the example they chose. Prefixing variables / functions with the underscore has long been a signal for "this is private" in languages that don't provide the functionality.


This is true, but the whole point of this article is to introduce a new way of handling private class members.


I think the idea is to distinguish them from class getter functions? I don't really understand it either.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: