[Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type


(Denis Nikitenko) #1

* What is your evaluation of the proposal?

+1. I think that overall it’s a step in the right direction.

* Is the problem being addressed significant enough to warrant a change to Swift?

A function that never returns is fundamentally different from any other function. Having this property captured in the function type - rather than additional meta-programming attributes - makes sense. It also prevents the language users from creating nonsensical function signatures, such as @noreturn func test() -> Int (which happily compiles and runs fine in XCode 8).

The NoReturn type has precedence in both computer science theory and modern general purpose programming languages. I suspect a more generally named universal bottom type would be more "future-proof", but I have no strong opinion on the matter.

While this is a breaking change, it affects a small corner of the language. I see the benefit outweighing the cost.

* Does this proposal fit well with the feel and direction of Swift?

Yes.

* If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I am aware of the existence of the bottom type in Scala and Rust, but I haven’t worked with them.

* How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick review, as well as a quick scan through the literature.