On Monday, 27 June 2016 at 11:05:49 UTC, cym13 wrote:
What's unintuitive about it (real question)? It would make it behave more like a standard if and early returns are very common, well understood and good practice:

void func(int* somepointer) {
    if (somepointer == null)
        return;
    [rest of the code]
}

From this perspective, you are right. But mixing "return" or "throw" which belong to the "run-time world", and "static if" which is "compile-time" feels wrong somehow to me.

But maybe I'm biased by my C experience. It's like mixing "return" and "#if".

Some other negative responses in this thread may also give a better explanation of what I mean.

The other thing is that, introducing that will not break any code (a priori). But if the change is made, and it turns out to not pay enough or lead to some abuse (more on the readability part), going backward shall introduce code-breakage.

Also, I agree with QAston comments about errors on unreachable code.

Maybe "static return" is a good compromise?...

Reply via email to