Where statement

Michel Fortin michel.fortin at michelf.com
Sun Jul 25 06:21:33 PDT 2010


On 2010-07-25 08:33:53 -0400, bearophile <bearophileHUGS at lycos.com> said:

> D lambdas can be multiline, so that's not a problem.
> But it can be useful to write more readable expressions when they are complex:
> 
> auto c = sqrt(a*a + b*b) where {
>     auto a = retrieve_a();
>     auto b = retrieve_b();
> }

Is this really an improvement over using a delegate literal?

	auto c = {
		auto a = retrieve_a();
		auto b = retrieve_b();
		return sqrt(a*a + b*b);
	};


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list