[swift-evolution] Idea: change "@noreturn func f()" to "func f() noreturn"

Jean-Daniel Dupas mailing at xenonium.com
Fri Feb 26 01:39:14 CST 2016


> Le 25 févr. 2016 à 23:40, Joe Groff via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 
>> On Feb 25, 2016, at 2:40 PM, Radosław Pietruszewski <radexpl at gmail.com> wrote:
>> 
>> 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…
> 
> There's no magic. If you can't construct a value of your return type, you can't return.

Just curious about how you would implement such function if there is no compile magic ?

How do you tell the compiler is it not an error that your function never return while it is declared to return something ?




More information about the swift-evolution mailing list