<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 25, 2016, at 1:44 PM, Jacob Bandes-Storch via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">Premise: there are multiple ways of describing control-/data-flow when a function is called:</div><div class=""><br class=""></div><div class=""><font face="arial, helvetica, sans-serif" class=""> func x() <b class="">-> T</b> // x returns a value, of type T, to the caller</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""> func x() <b class="">throws</b> // x may throw an error to the caller</font></div><font face="arial, helvetica, sans-serif" class=""> func x() <b class="">throws -> T</b> // x may throw an error, and also return a value</font><div class=""><font face="arial, helvetica, sans-serif" class=""> func x(...) <b class="">rethrows</b> ... // if a closure argument can throw an error, x may also throw</font><div class=""><font face="arial, helvetica, sans-serif" class=""> <b class="">@noreturn</b> func x() // x never returns to the caller</font></div><div class=""><br class=""></div><div class="">"noreturn" is currently spelled as an attribute, but like "throws" / "rethrows" / "-> T", it's really describing how control flow works.</div><div class=""><br class=""></div><div class="">IMO this calls for consistency: whatever happens "after" the function is called should appear "after" the parameter list.</div><div class=""><br class=""></div><div class=""><font face="arial, helvetica, sans-serif" class=""> func x() <b class="">noreturn</b> {</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""> ...</font></div><div class=""><font face="arial, helvetica, sans-serif" class=""> }</font></div><div class=""><br class=""></div><div class=""><br class=""></div>Thoughts?<br clear="all" class=""></div></div></div></blockquote><br class=""></div><div>We really don't even need a special syntactic form or attribute for 'no return' at all. We could provide a standard unconstructible type:</div><div><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div>public /*closed*/ enum NoReturn {}</div><div><br class=""></div></blockquote>and it would be impossible for a function that returns NoReturn to return normally.<div class=""><br class=""></div><div class="">-Joe<br class=""><br class=""></div></body></html>