On 03/27/2013 06:46 PM, deadalnix wrote:
On Wednesday, 27 March 2013 at 17:23:01 UTC, Timon Gehr wrote:
I strongly disagree. What would be an example of the problems you are
apparently experiencing?


T foo(alias fallback)() {
     // Do some processing return the result. If an error occurs use
fallback mechanism.
}

Reasonable thing to do as fallback is to try another method workaround
the error, throw, whatever.

The problem is that the fallback type inference makes it painful to work
with, especially if fallback is a template itself.

For instance, in SDC, you can parse ambiguous things as follow :
parseTypeOrExpression!((parsed) {
     static if(is(typeof(parsed) : Expression)) {
         // Do something
     } else {
         throw SomeException();
     }
})(tokenRange);


I see. What is needed is a way to specify that a function does never return. (eg. a bottom type)

This is bound to fail. When a function never return, it make no sens to
force a type on it and the magic subtype typeof(null) should be used (as
typeof(null) can cast to anything, it is valid to call the function in
any condition).

It cannot cast to everything.

Reply via email to