> class Blahh > toX: TYPE_A > toY: TYPE_B > fn SetXandY(toX, toY) > enfunc > endclass
So... like you said, that was confusing. But, I just realised that prefixing member variables with "this" everywhere consistently could perhaps allow us to do something in between, along these lines? class Blahh this.toX: TYPE_A this.toY: TYPE_B fn SetXandY(this.toX, this.toY, Z : TYPE_C) blahh blah.. enfunc endclass Could we make this signature pattern auto assign this.toX and this.toY, for any function? I'm just exploring other possibilities inspired by the idea you presented with respect to the new() constructor. > Simplifying the new() method ~ > > Many constructors take values for the object members. Thus you very often see > this pattern: > > > this.lnum: number > this.col: number > > def new(lnum: number, col: number) > this.lnum = lnum > this.col = col > enddef > > Not only is this text you need to write, it also has the type of each member > twice. Since this is so common a shorter way to write new() is provided: > > > def new(this.lnum, this.col) > enddef > > The semantics are easy to understand: Providing the object member name, > including "this.", as the argument to new() means the value provided in the > new() call is assigned to that object member. This mechanism is coming from > the Dart language. Why limit this idea to only the new constructor? -- -- 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/e199e7b2-a852-451b-8700-718d4bbb533bn%40googlegroups.com.