<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></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 06 Jun 2016, at 22:40, Michael Peternell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">E.g. with the proposal, the following function:</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">@noreturn func error&lt;T&gt;(msg: String = "") -&gt; T {</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;fatalError("bottom: \(msg)")</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">}</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">has to be written as</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">func error&lt;T&gt;(msg: String = "") -&gt; T {</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">&nbsp;&nbsp;&nbsp;fatalError("bottom: \(msg)")</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">}</span><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Menlo-Regular; font-size: 11px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It still returns bottom, but there is no way to say so in the declaration. The proposal just made the language less expressive!</span></div></blockquote></div><br class="">This isn't my understanding of the idea. My understanding is that instead of a generic function, you'd write `error` as:<div class=""><br class=""></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; <b class="">func</b> error(_ msg: String = "") -&gt; Never {</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; &nbsp; &nbsp; fatalError("bottom: \(msg)")</font></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; &nbsp; &nbsp; // or equivalently, since fatalError() also returns Never:</font></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; &nbsp; &nbsp; //return fatalError("bottom: \(msg)")</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; }</font></div><div class=""><br class=""></div><div class="">And because `<font face="Menlo" class="">Never</font>` is a real bottom type (this is probably the extra compiler support needed that Chris Lattner referred to), you can use this function in any type context, meaning that it behaves as if it's of type `∀x. String → x`:</div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo;" class=""><font color="#919191" class="">&nbsp; &nbsp; // Example 1:</font></span></div><div class=""><span style="font-family: Menlo;" class="">&nbsp;&nbsp; &nbsp;func someImplementationDetail(input: Int) -&gt; [String] {</span></div><div class=""><span style="font-family: Menlo;" class=""><font color="#919191" class="">&nbsp; &nbsp; &nbsp; &nbsp; // ...</font></span></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; &nbsp; &nbsp; return error("unimplemented for now")</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; }</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; // Example 2:</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; var ints: [Int] = []</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; ints.append(error("FIXME"))</font></div><div class=""><font face="Menlo" class=""><br class=""></font></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; // Example 3:</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; let e: Either&lt;String, String&gt; = ...</font></div><div class=""><span style="font-family: Menlo;" class="">&nbsp; &nbsp; let s: String = e.left ?? e.right ?? error("impossible")</span></div><div class=""><br class=""></div><div class="">I would even consider specifying that <b class="">every</b>&nbsp;empty enum type behaves like this, and that `<font face="Menlo" class="">Never</font>` was just the default you should probably use, defined in the stdlib as:</div><div class=""><br class=""></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; /// The bottom type, or return type of functions that do not return.</font></div><div class=""><font face="Menlo" color="#919191" class="">&nbsp; &nbsp; /// This enum is intentionally empty.</font></div><div class=""><font face="Menlo" class="">&nbsp; &nbsp; <b class="">enum</b> Never {}</font></div><div class=""><br class=""></div><div class="">In other words in my imagination, there would be <b class="">no</b>&nbsp;magic in the type `<font face="Menlo" class="">Never</font>` per se, but in the treatment of empty enums in general.</div><div class=""><br class=""></div><div class="">— Pyry</div><div class=""><br class=""></div></body></html>