Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type
-1 for all the reasons already mentioned. Although, if we end up accepting this anyway, FWIW I'd prefer "DoesNotReturn" or "NeverReturns" over "NoReturn" or "Never". They both read better to me, and their imperative names help make it clearer that something is different. - Dave Sweeris > On Jun 21, 2016, at 12:03, Chris Lattnerwrote: > > Hello Swift community, > > The review of "SE-0102: Remove @noreturn attribute and introduce an empty > NoReturn type" begins now and runs through June 27. The proposal is available > here: > > > https://github.com/apple/swift-evolution/blob/master/proposals/0102-noreturn-bottom-type.md > > Reviews are an important part of the Swift evolution process. All reviews > should be sent to the swift-evolution mailing list at > >https://lists.swift.org/mailman/listinfo/swift-evolution > > or, if you would like to keep your feedback private, directly to the review > manager. > > What goes into a review? > > The goal of the review process is to improve the proposal under review > through constructive criticism and contribute to the direction of Swift. When > writing your review, here are some questions you might want to answer in your > review: > >* What is your evaluation of the proposal? >* Is the problem being addressed significant enough to warrant a change to > Swift? >* Does this proposal fit well with the feel and direction of Swift? >* If you have used other languages or libraries with a similar feature, > how do you feel that this proposal compares to those? >* How much effort did you put into your review? A glance, a quick reading, > or an in-depth study? > > More information about the Swift evolution process is available at > >https://github.com/apple/swift-evolution/blob/master/process.md > > Thank you, > > -Chris Lattner > Review Manager > > ___ > swift-evolution-announce mailing list > swift-evolution-annou...@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution-announce ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution
Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type
> * What is your evaluation of the proposal? I like the idea, but not the name. I would prefer a more general name like `Never`. If `NoReturn` becomes a universal bottom type, it's going to need a more universal name than `NoReturn` It's very narrow and specialized, so it's not appropriate for bottom types in other contexts; just think of the `NoReturn?` variable created by optional chaining, or the `[NoReturn]` array created by `map`. As soon as you take even the tiniest step away from a return value, the name doesn't really make sense anymore. Therefore, I strongly suspect we'll have to change this name again in the future as `NoReturn` becomes a more powerful bottom type. I'm not really looking forward to changing `@noreturn` to `-> NoReturn` in Swift 3 and then changing it again to `-> Never` in Swift 4, so I think we should just do it here and now. I also don't like the way `NoReturn` reads. It *is* understandable, but it bluntly disobeys type naming conventions by describing not the value being returned, but the member returning it. There are many sensible names we might have given `Void` if not for C—`Nothing`, `None`, `Empty`—but I don't think anybody would advocate for `EmptyReturn`. It just isn't an appropriate type name. An attribute is an adjective describing a member, and `@noreturn` (or rather, `@nonreturning`) is a perfectly fine adjective to attach to a function, so the name works fine there. But a type is a *noun* describing a *value*, and `NoReturn` is not. You are trying to cram a square peg into a round hole. > * Is the problem being addressed significant enough to warrant a change > to Swift? Yes. Something should be done about `@noreturn`, and this basic approach is the most elegant one available. > * Does this proposal fit well with the feel and direction of Swift? The approach, but not the name. As I pointed out previously, it does not match naming conventions or even the general semantic meaning of a return type. (Incidentally, another reason I like the idea of eventually having a subtype-of-all-types `Never` is that I think we should treat `UnsafePointer` as our "pointer of uncertain type" type. That is, `void *` should be imported to Swift as `UnsafePointer`. That would inherently prevent you from using the `pointee` property, and if you thought of `sizeof(Never)` as being infinite—a plausible interpretation since `Never` *could* be a subtype of a type of any size—it would also imply that pointer arithmetic or allocation of `Never` buffers would always overflow unless you were handling zero `Never`s.) > * If you have used other languages or libraries with a similar feature, > how do you feel that this proposal compares to those? I've used other languages with equivalents to `@noreturn`, and I think the bottom return value approach will be an improvement on that. > * How much effort did you put into your review? A glance, a quick > reading, or an in-depth study? Quick reading of the final proposal, but I've participated in much of the discussion about this feature. -- Brent Royal-Gordon Architechies ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution
Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type
* What is your evaluation of the proposal? -1. I don't believe that the '-> NoReturn' adequately expresses the behavior of a function. I view the construction 'T -> U' as a contract which states 'give me a T and I'll give you a U'. This stops making sense when U is NoReturn: 'give me a T and I'll give you a NoReturn (note: I won't actually give you a NoReturn)'! This construction also moves the behavioral information about the function to the end of the signature, where it is more easily missed. * Is the problem being addressed significant enough to warrant a change to Swift? I don't believe so. The main argument against @noreturn seems to be about complexity in the compiler, and an empty/bottom NoReturn type introduces complexity of its own with regards to subtyping, and special-casing the compiler to handle functions which return a particular type. * Does this proposal fit well with the feel and direction of Swift? Again, not IMO. Semantic modifications to function behavior in Swift are already well encompassed by attributes. These are a well established part of the language; if @noreturn were one of few attributes that were not wanted in the language, that would be a different matter, but attributes aren't going anywhere. Furthermore, I think that swift has mostly shied away from overly clever solutions in favor of clarity. I realize the desire in increasing the power of Swift's type system, but extending it to include properties which are arguably outside of the type system altogether doesn't seem like the right direction to go in. * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those? - * How much effort did you put into your review? A glance, a quick reading, or an in-depth study? I read through the proposal and then the initial discussion on swift-evolution. Overall, I think that the @noreturn attribute better expresses that the behavior of the function is exceptional. NoReturn feels a bit too much like a clever hack to represent a type-that-is-not-a-type. Freddy On Jun 21, 2016, at 10:04 AM, Chris Lattnerwrote: Hello Swift community, The review of "SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type" begins now and runs through June 27. The proposal is available here: https://github.com/apple/swift-evolution/blob/master/proposals/0102-noreturn-bottom-type.md Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at https://lists.swift.org/mailman/listinfo/swift-evolution or, if you would like to keep your feedback private, directly to the review manager. What goes into a review? The goal of the review process is to improve the proposal under review through constructive criticism and contribute to the direction of Swift. When writing your review, here are some questions you might want to answer in your review: * What is your evaluation of the proposal? * Is the problem being addressed significant enough to warrant a change to Swift? * Does this proposal fit well with the feel and direction of Swift? * If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those? * How much effort did you put into your review? A glance, a quick reading, or an in-depth study? More information about the Swift evolution process is available at https://github.com/apple/swift-evolution/blob/master/process.md Thank you, -Chris Lattner Review Manager ___ swift-evolution-announce mailing list swift-evolution-annou...@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution-announce ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution
Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type
On Tue, Jun 21, 2016 at 10:04 AM Chris Lattnerwrote: > Hello Swift community, > > The review of "SE-0102: Remove @noreturn attribute and introduce an empty > NoReturn type" begins now and runs through June 27. The proposal is > available here: > > > https://github.com/apple/swift-evolution/blob/master/proposals/0102-noreturn-bottom-type.md > > Reviews are an important part of the Swift evolution process. All reviews > should be sent to the swift-evolution mailing list at > > https://lists.swift.org/mailman/listinfo/swift-evolution > > or, if you would like to keep your feedback private, directly to the > review manager. > > What goes into a review? > > The goal of the review process is to improve the proposal under review > through constructive criticism and contribute to the direction of Swift. > When writing your review, here are some questions you might want to answer > in your review: > > * What is your evaluation of the proposal? > +1. Encoding this behavior in the return type of a function is far more natural than having an attribute that exists outside the type system. I also don't think that it unduly restricts us from expanding its use into a "true" bottom type in the future. I prefer the name "Never" because it reads cleanly (func foo(...) -> Never == "function foo takes ... as arguments and returns never"), and it works well in some of the possible future scenarios described in the proposal. While "Never" feels slightly less suitable as a true bottom type name, other alternatives like "None" or "Nothing" feel too close to existing Swift concepts, like the "none" case in Optional. You can still argue that "Never" works here though, in the sense that you will "Never" have a value of that type. > * Is the problem being addressed significant enough to warrant a > change to Swift? > Yes. The benefits both in user case and in simplifying the language implementation are strong. > * Does this proposal fit well with the feel and direction of Swift? > Yes, this moves Swift in the direction of consistency that other proposals have done. > * If you have used other languages or libraries with a similar > feature, how do you feel that this proposal compares to those? * How much effort did you put into your review? A glance, a quick > reading, or an in-depth study? > Read the proposal and participated in some of the earlier discussions. > > More information about the Swift evolution process is available at > > https://github.com/apple/swift-evolution/blob/master/process.md > > Thank you, > > -Chris Lattner > Review Manager > > ___ > swift-evolution-announce mailing list > swift-evolution-annou...@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution-announce > ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution
Re: [swift-evolution] [swift-evolution-announce] [Review] SE-0102: Remove @noreturn attribute and introduce an empty NoReturn type
I have to say, this might be the most swifty of the swift proposals. There's something about it that's elegant and beautiful, so big +1 from me. I do think Never makes more sense, but I understand the clarity that NoReturn brings. For a feature that most probably won't even use, maybe we could get away with it being Never... Brandon > On Jun 21, 2016, at 1:03 PM, Chris Lattnerwrote: > > Hello Swift community, > > The review of "SE-0102: Remove @noreturn attribute and introduce an empty > NoReturn type" begins now and runs through June 27. The proposal is available > here: > > > https://github.com/apple/swift-evolution/blob/master/proposals/0102-noreturn-bottom-type.md > > Reviews are an important part of the Swift evolution process. All reviews > should be sent to the swift-evolution mailing list at > >https://lists.swift.org/mailman/listinfo/swift-evolution > > or, if you would like to keep your feedback private, directly to the review > manager. > > What goes into a review? > > The goal of the review process is to improve the proposal under review > through constructive criticism and contribute to the direction of Swift. When > writing your review, here are some questions you might want to answer in your > review: > >* What is your evaluation of the proposal? >* Is the problem being addressed significant enough to warrant a change to > Swift? >* Does this proposal fit well with the feel and direction of Swift? >* If you have used other languages or libraries with a similar feature, > how do you feel that this proposal compares to those? >* How much effort did you put into your review? A glance, a quick reading, > or an in-depth study? > > More information about the Swift evolution process is available at > >https://github.com/apple/swift-evolution/blob/master/process.md > > Thank you, > > -Chris Lattner > Review Manager > > ___ > swift-evolution-announce mailing list > swift-evolution-annou...@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution-announce ___ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution