The NoReturn type would have to be a bottom type so that a method returning an X could be overridden with NoReturn. I think that would be compiler magic in Swift rather than an enum you couldn't instantiate. +1 to changing to a type rather than an annotation, it reads a lot better to me. <span></span><br><br>On Saturday, 27 February 2016, Joe Groff via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On Feb 25, 2016, at 11:39 PM, Jean-Daniel Dupas <<a href="javascript:;" onclick="_e(event, 'cvml', 'mailing@xenonium.com')">mailing@xenonium.com</a>> wrote:<br>
><br>
><br>
>> Le 25 févr. 2016 à 23:40, Joe Groff via swift-evolution <<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')">swift-evolution@swift.org</a>> a écrit :<br>
>><br>
>><br>
>>> On Feb 25, 2016, at 2:40 PM, Radosław Pietruszewski <<a href="javascript:;" onclick="_e(event, 'cvml', 'radexpl@gmail.com')">radexpl@gmail.com</a>> wrote:<br>
>>><br>
>>> Ah, that’s a neat idea! Not sure it’s an improvement though to have a magic type that changes how the compiler treats your method, rather than a rather explicit *attribute* on the method…<br>
>><br>
>> There's no magic. If you can't construct a value of your return type, you can't return.<br>
><br>
> Just curious about how you would implement such function if there is no compile magic ?<br>
><br>
> How do you tell the compiler is it not an error that your function never return while it is declared to return something ?<br>
<br>
The compiler can tell statically that a closed, empty enum type is uninhabited, and thereby figure out that it's impossible for a function returning an uninhabited type can't possibly return.<br>
<br>
-Joe<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'swift-evolution@swift.org')">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
</blockquote><br><br>-- <br>-- Howard.<br>