Maxim Fomin:

This is identifiers shadowing issue. In best case you could not define boolean f, so the problem would not arise in a first place.

See also the discussion here:
http://d.puremagic.com/issues/show_bug.cgi?id=9521

Is it right for with to not give an error here?


struct Foo { int x; }
int x;
void main() {
    Foo f;
    with (f) {
        x++;
    }
}


Silent shadowing of global (module-level in both Python and D) names has caused me many problems along the years.

Bye,
bearophile

Reply via email to