Would it be possible (and useful) to introduce declarations like `auto foo() if(isInputRange(auto));`

Roman D. Boiko rb at d-coding.com
Thu May 17 04:49:16 PDT 2012


Is there anything preventing us from adding constraints on the 
auto function return value? I mean, such language extension seems 
to be quite useful.

For example, it would be no longer necessary to provide method 
bodies for functions with auto return values.

In many cases this would eliminate the need for introducing an 
interface.

interface returnsDuckTyped
{
     auto foo() if(isInputRange(auto));
}


More information about the Digitalmars-d mailing list