www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to explicitly state the expression in with(...)?

I have quite often this pattern:

with(x.y.z){
	xyzFunc();	// = x.y.z.xyzFunc()
	myFunc(x.y.z, ...);
}

and it would be cool to write:

with(t = x.y.z){ // work like an implicit alias
	xyzFunc();	// = x.y.z.xyzFunc()
	myFunc(t, ...);
}

Is there anything which comes near this idea?

-- 
Robert M. Münch
http://www.saphirion.com
smarter | better | faster
Feb 01 2020