[swift-evolution] [swift-evolution-announce] [Review] SE-0047 Defaulting non-Void functions so they warn on unused results

Brent Royal-Gordon brent at architechies.com
Wed Mar 16 18:27:22 CDT 2016


> 	• What is your evaluation of the proposal?

I am in favor of the semantic, but I don't like `@discardableResult`; it's long and unwieldy. I would prefer that we either use a shorter word than "discardable", attach the keyword to the return type as discussed in "Future Directions", or both.

I also don't like that this proposal doesn't include an "Impact on existing code" section. We ought to decide whether the migrator will add `@discardableResult` to existing symbols or not.

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

Yes. I should use `@warn_unused_result`, but never bother because it's just too much of a hassle. My code will be safer with this change.

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

Yes. This kind of safety and explicitness is very Swifty.

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

I believe most languages I used either had "every function returns its last expression" semantics, or had an optional warning but no well-publicized way to suppress it for a given function.

> 	• 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 discussion.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list