[swift-evolution] Make non-void functions @warn_unused_result by default

Tino Heth 2th at gmx.de
Wed Mar 2 15:14:53 CST 2016


> -1 on implementing an attribute to allow API designers to mark it as discardable
This might be fine for your style, but please don't ignore that there is no single way:
Techniques like method chaining aren't common in Cocoa, but my guess that this is just because the syntax of Objective-C is a bad fit for chaining, which looks much nicer in Swift.

> let _ = discardableResult()

Imho the problems of using "_" to discard results are clearly visible in this thread:
"let" isn't needed, yet it is used in many examples…

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


More information about the swift-evolution mailing list