why is _foo accessed by _foo, while foo is accessed by .foo
why is not _foo accessed by ._foo
isnt this inconsistent?
Forums
private vs public
2 posts
• Page 1 of 1
Re: private vs public
Perfectly consistent syntax isn't necessarily enjoyable in practice (think LISP).
Note that _foo is not allowed for arguments, locals or type declarations. So it already indicates a member.
Visually, _foo is very distinguishable from locals and types. Also, in an environment with intellisense/autocompletion the underscore will immediately limit the choices down to underscored members (similar to how . would limit choices down to members).
Finally, in practice, I found ._foo to be redundant (Cobra use to allow that).
Note that _foo is not allowed for arguments, locals or type declarations. So it already indicates a member.
Visually, _foo is very distinguishable from locals and types. Also, in an environment with intellisense/autocompletion the underscore will immediately limit the choices down to underscored members (similar to how . would limit choices down to members).
Finally, in practice, I found ._foo to be redundant (Cobra use to allow that).
- Charles
- Posts: 2515
- Location: Los Angeles, CA
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 47 guests