On 7/9/17 7:07 AM, Nicholas Wilson wrote:
On Sunday, 9 July 2017 at 10:59:43 UTC, Steven Schveighoffer wrote:
On Sunday, 9 July 2017 at 10:51:50 UTC, Daniel N wrote:
On Sunday, 9 July 2017 at 10:31:47 UTC, Mr.D wrote:
On Saturday, 8 July 2017 at 10:15:39 UTC, Walter Bright wrote:

Has anyone a better idea?

What about

scope(exit) assert(0);

?

void func()
out { assert(0); }
body
{
}

Yes, this!

That certainly signals intention, but I still think that an attribute is a whole lot simpler than compiler voodoo like this or the "None" discussed earlier.

This whole proposal is compiler voodoo :)

Unlike a currently undefined attribute, assert(0) in the out contract currently is effective to mean no return. It also guarantees that if there is a return statement somewhere, it still doesn't return.

Also, since the out contract is part of the signature, it will still be present in the case of separate compilation.

The one disadvantage, is that -release removes contracts. So in this particular case, the out contract should remain.

Not sure if it has been mentioned yet, but @disable(return) could work as something that doesn't add any new attributes.

-Steve

Reply via email to