<div dir="ltr">I vote for Bottom or Never. None does not convey "this should not occur or be evaluated".</div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Jun 5, 2016 at 2:26 PM, Антон Жилин <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>The following names were suggested: NoReturn, Bottom, None, Never.<br></div><div>I would pick None, because it looks like opposite to Any and fits nicely in generic types.</div><div><br></div><div>I would prefer the type to be simple, and be implemented as a case-less enum (not a bottom value, as in Haskell).<br></div><div><br></div><div>None should be a usual enum, with no compiler magic except that functions returning None are equivalent to current @noreturn.</div><div><br></div><div>Example 1.</div><div>let x: None?</div><div>// ...</div><div>let y = x!</div><div><br></div><div>It will trap in runtime not because we discover scary bottom thing, as in Haskell, but because x had value Optional.none at that moment and we asserted otherwise.</div><div>We could prove that it is always true in this case, but compiler must be stupid about this.</div><div><br></div><div>Example 2.</div><div>Compiler should allow including None in structures. Error will show up in constructor, when we will not be able to initialize the field.</div><div><br></div><div>Example 3.</div><div>None in an enum case makes that case never appear in values of such a type. But compiler can not know about that.<br></div><div><br></div><div>- Anton</div></div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>