Doub Kearns wrote:
> I'm a bit short on time today but I have a few thoughts, some of which may
> be partially reiterated from the previous related thread, to keep the ball
> rolling.
Thanks for your opinions. I'll take them into account.
> = Underscore for Private Access =
>
> The current implementation's asymmetry with regard to the private
> underscore prefix and public modifier keyword isn't particularly elegant.
> I note that it largely disappears with your newly proposed change of
> defaulting to public access.
>
> Irrespective, I'd prefer keywords were used for access modification. A
> leading underscore is used for many ad-hoc purposes such as reserved words,
> member fields, pseudo private fields and generally to work around perceived
> deficiencies in a language. It has a lot of baggage and I wouldn't like to
> see it become semantically significant.
Mostly a matter of taste, but also it has a history, using an underscore
for private members has been used in many style guides (even if the
language doesn't do anything with it).
Considering:
> - Are private methods planned? I don't think I noticed any reference to
> these one way or the other in the help.
Yes, we should support private methods. The question then is how to
specify that. Using the same mechanism as for members would be
expected. With an underscore:
this._privateMember = 'text'
def _PrivateFunc()
With a keyword:
private this.privateMember = 'text'
private def PrivateFunc()
To me this doesn't appear to change the preference for how to mark
members as private.
> - Is it intended that public fields can have the same name (ignoring the
> underscore) as private fields?
No, we should not allow that, it is not only confusing, it also makes it
difficult to change a member from private to public later.
> - Are final fields planned?
Not sure. "final" is an extra mechanism and it doesn't add
functionality. It is mainly useful in larger, multi-person projects
where you don't want others to overrule your class/method/etc.
It can make writing tests more difficult.
--
George: "I just got a new set of golf clubs for my wife!"
John: "Great trade!"
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20230124170321.57A741C0C1A%40moolenaar.net.