Does D have too many features?

Timon Gehr timon.gehr at gmx.ch
Mon Apr 30 11:56:39 PDT 2012


On 04/30/2012 05:35 PM, H. S. Teoh wrote:
> On Mon, Apr 30, 2012 at 10:21:23AM +0200, bearophile wrote:
>> H. S. Teoh:
>>
>>> I think the correct solution here is to use alias. (If that doesn't
>>> work, then it should be made to work. It's a lot cleaner and doesn't
>>> introduce potentially nasty ambiguities into code,
>>
>> What ambiguities?
> [...]
>
> 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;
> 		}
> 	}
>
> [snip.]

You probably should try compiling that code. ;)


More information about the Digitalmars-d mailing list