I just became aware of http://dlang.org/phobos/std_exception.html#.ifThrown . It's neat, but it seems non-obvious to me how lazy + UFCS should work in general.

consider


void lazily(T)(lazy T expression)
{
   expression();
}

It's clear when saying lazily(a.b().c()); that the whole of "a.b().c()" is going to be evaluated lazily. With UFCS though, I'm more unsure:

is a.b().c().lazily() -> lazily(a.b().c()) or is it more akin to

auto tmp = a.b();
lazily(tmp.c());

If the later is it possible to force the former while still using UFCS, ie is (a.b().c()).lazily() different than a.b().c().lazily()?


Reply via email to