How does laziness and UFCS interact?
Logan Capaldo via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Mar 9 15:03:29 PDT 2015
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()?
More information about the Digitalmars-d-learn
mailing list