++ on that bug report. On a similar note, today I was rewriting a dsource class example because I wanted to show that you can use "this.name" to assign to fields that have the same name as a parameter. And then I accidentally made this mistake when writing a different method:
class Foo { string name; void printMe() { name = "test"; writefln("printMe.name = %s, Foo.name = %s", name, this.name); } } The "name" in the printMe method was supossed to be the declaration 'string name = "test";'. But I forgot to put the type before name, and inadvertently modified the class variable name. In this case I wasn't even passing any parameters, so this is unfortunately impossible to flag as an error because using "this" is optional in D. On Mon, Sep 6, 2010 at 4:14 AM, bearophile <bearophileh...@lycos.com> wrote: > Andrei: >> If you can write (new Foo).x = x, then you can also write this.x = x. Try it >> now! > > See my bug reports/enhancement requests (about three days ago in a program of > mine I have added a bug that enhancement 4407 is able to avoid): > > Arguments and attributes with the same name > http://d.puremagic.com/issues/show_bug.cgi?id=3878 > > Bye, > bearophile >