What are thoughts on issuing a warning when accessing a member variable without going through the this reference?
struct A {
int i;
this(int i)
{
i = i; // <-- Warning
this.i = i; // <-- Ok
}
}
My request is motivated by the specific issue highlighted in this example, but this check in general would remove some ambiguities, especially in constructors (I don't know easy it would be to limit the check to constructors, though).
It would surely be extremely noisy for most projects, so maybe would make most sense to be disabled by default.
What are thoughts on issuing a warning when accessing a member variable without going through the
this
reference?My request is motivated by the specific issue highlighted in this example, but this check in general would remove some ambiguities, especially in constructors (I don't know easy it would be to limit the check to constructors, though).
It would surely be extremely noisy for most projects, so maybe would make most sense to be disabled by default.