Conditional invocation
How does everyone shorten the following?
if( func1() )
return func1();
else // Yes, I put an else here
return func2();
Calling func1() twice is obviously undesirable, the return value is not a Boolean, so the
return func1() || func2();
is not an option. Block with a temp variable looks weird:
{
type t = func1();
return t ? t : func2();
}
There is no built-in "coalesce" operator.