On 8/19/2011 8:17 AM, Andrej Mitrovic wrote:
It's not just globals. It's hiding fields as well:

class A
{
     int x;
     this()
     {
          int x; //<- hides this.x
     }
}

I've had this happen during a cut/paste session, which happens when
I'm refactoring my code.
I actually use this on PURPOSE -- I always use the 'this' pointer when referring to members anyway. It's a great way to avoid unnecessarily renaming x to things like x1, x_1, x_, _x, x0, x_0, this_x, my_x, myx, etc...

Even more common with constructor parameters and instance fields.

Reply via email to