> I'm not a big fan of the "this" keyword.   I agree if going to use it, 
> ensure to use it everywhere.  Consistency is good.  I like simplicity, and 
> dislike redundancy.

What do you mean, do you prefer "self"?

> So, about "this", alternatively,  don't use it anywhere, but maybe you 
> could throw an error if a function argument name is also member variable 
> name.

That is actually very common.  It is very likely that methods pass
arguments to set or modify the object members, thus using the same name
is very likely to happen.

> Not sure what static analysis is available - given that its a 
> scripting language.  There's not really a compilation step is there?

Some minimal checks can be done, but static analysis is too complicated
and time consuming to build in.

> OR, perhaps another option, just thinking outside the box, if a function 
> argument does actually happen to match a member variable name - then 
> automatically force it to actually set that variable.  When (if) this 
> becomes the expected behavior, I think it would enable simplifying some 
> things a lot.

Boundary checks are often done on arguments, assuming that the argument
is always assigned to an object member is too limiting.

I also want to avoid doing things very differently from what existing
languages are doing.  Some different syntax and rules can be acceptable,
but introducing new mechanisms that are hard to understand are to be
avoided.

> Explaining with an example.  Often, when I'm coding and the arg name is the 
> same as a member variable name,  then I usually find myself setting that 
> early-ish in the code.  (just using a pseudo code to explain, obviously not 
> real code;)
> 
> class Blahh
> this.toX: TYPE_A
> this.toY: TYPE_B
> fn SetXandY(toX: TPYE_A, toY: TYPE_B )
>   this.toX = toX
>   this.toY = toY
> enfunc
> endclass
> 
> So, I find that pattern happens a lot.  And it gets real tedious.    I 
> think this could be simplified to the following;
> 
> class Blahh
> toX: TYPE_A
> toY: TYPE_B
> fn  SetXandY(toX, toY)
> enfunc
> endclass
> 
> ie. This would set the member variables, toX and toY automatically.

I don't know any language that does this and I find it very obscure and
confusing.  Also, it makes giving useful errors difficult.  Using an
argument name that happens to be a member name would not result in any
error but silently turned into an assignment.

[...]

-- 
A computer programmer is a device for turning requirements into
undocumented features.  It runs on cola, pizza and Dilbert cartoons.
                                        Bram Moolenaar

 /// Bram Moolenaar -- b...@moolenaar.net -- 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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20221219142609.5D0811C09F0%40moolenaar.net.

Raspunde prin e-mail lui