Does D have too many features?

bearophile bearophileHUGS at lycos.com
Mon Apr 30 08:47:59 PDT 2012


H. S. Teoh:

> When you have nested with's.
>
> Or when the object members shadow local variables in the parent 
> scope.
>
> 	struct S {
> 		int x;
> 	}
>
> 	void main() {
> 		int x, y;
> 		S s;
>
> 		with(s) {
> 			x = 1;
> 			y = 2;
> 		}
> 	}

That code doesn't compile:

test.d(10): Error: with symbol test.S.x is shadowing local symbol
test.main.x

Bye,
bearophile


More information about the Digitalmars-d mailing list