Does anyone use 'with' statement?

Xinok xnknet at gmail.com
Sun Dec 9 01:18:06 PST 2007


I can see where with statements can make code harder to read. I think 
it's important to make it more explicit, so others reading your code 
don't have to guess where a symbol is coming from.

We could overload the global operator to do just that. It's purpose 
changes when it's used in the with statement.

class N{
	int a, b, c;
}

void main(){
	int a, b, c;
	N obj = new n;
	with(obj){
		a = 35; // main.a
		.a = 60; // obj.a
	}
}



More information about the Digitalmars-d mailing list