[swift-evolution] [Draft] Change @noreturn to unconstructible return type

Charles Srstka cocoadev at charlessoft.com
Tue Jun 7 16:33:23 CDT 2016


> On Jun 7, 2016, at 3:56 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> No doubt, @noreturn is clearer today, but how much of that is because it's what we already know?

None. It’s clearer because it does exactly what it says on the tin. Show it to someone who’s familiar with the concept of functions and returning but who's never seen Swift before, and they will intuit what it does.

> And FWIW, "returns never" is hard to misinterpret, no?

“returns never” isn’t what you have, though. You have func foo() -> Never, which could mean a bunch of things. It could mean it never returns a *value*, i.e. a void return. It could mean someone made some crazy struct and named it Never. It’s not obvious from looking at it without prior knowledge of the system.

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160607/89d7988e/attachment.html>


More information about the swift-evolution mailing list