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

Gwendal Roué gwendal.roue at gmail.com
Wed Mar 2 09:51:42 CST 2016

> Le 2 mars 2016 à 16:21, Step C via swift-evolution <swift-evolution at swift.org> a écrit :
>> On Mar 2, 2016, at 3:24 AM, Austin Zheng via swift-evolution <swift-evolution at swift.org> wrote:
>> Agreed. I think encouraging the "_ = returnValueIgnored()" pattern is a good way to have code disambiguate between "I don't care about the return value" and "I forgot to use it/called the wrong API method by accident". I've seen this issue in production code a couple of times.
> I have also used and seen this pattern a bunch ("_ = ...").  It communicates powerfully to later code readers with the intention is in the code.

Hello, we need more balance here.

`_ = …` does not communicate anything. It could be a latent bug because some corner case has been ignored, just as well as the intentional discarding of an unused value.



More information about the swift-evolution mailing list