On Mon, 26 Dec 2022 at 02:02, Bram Moolenaar <b...@moolenaar.net> wrote:
[...] > > This following currently defines a field and is, without context, > > indistinguishable from any other assignment. Is that intended? > > With "var" it's indistinguishable from another declaration, I don't > think it matters much that it looks like an assignment otherwise. > There's only one declaration per class assuming either a qualified name is used in the declaration or normal shadowing rules apply. So, ignoring subjective aesthetic issues, this would allow for tooling to more easily identify the declaration. [...] > > It seems from the documentation that static fields can be referenced as > > bare identifiers? This feels a bit unexpected to me given that instance > > fields are always qualified. > > Static fields (class members) are totally different from object members. > I have always found it confusing, in many languages it's hard to tell > them apart, especially if the declaration is further away. Always using > "this" for object members helps a lot for this. I would not know what > to use for class members. The only thing I have seen is using the class > name, which can be long (and gets tricky when using inheritance). > I believe most languages access class members directly, without a > prefix. > I think they're much the same in terms of the problems the required "this" qualifier is attempting to address. Static fields also need disambiguation in shadowed contexts and could, arguably, also use better identification. Are methods going to need to be qualified too? Cards on the table, I'm not in favour of requiring qualified references. I just found it surprising that only unqualified instance fields were considered a problem. Regards, Doug -- -- 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 vim_dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_dev/CAJ1uvoBEMBLsh1%2B8y-b%2BPw8uLi3VZtRNAob-PNV22ugNNt9fdQ%40mail.gmail.com.