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

Gwendal Roué gwendal.roue at gmail.com
Wed Mar 2 12:55:27 CST 2016

> Le 2 mars 2016 à 19:46, Dmitri Gribenko <gribozavr at gmail.com> a écrit :
>> As soon as there is a warning ignoring the returned value, as would be the default if the discussed proposal were accepted, people will start writing `_ = …` just to *silence* the warning.
> Only if the API is badly designed and not annotated properly.  You
> can't protect users from bad API design.  Saying that the feature is
> harmful because it can be misused in bad APIs is counter-productive,
> because this is true for almost every feature.

I’m happy that your coworkers and yourself are only producing good APIs! I won’t push against the proposal any longer, thanks to Stephen Cellis and Pyry Johkola, but you know, taming misuses are an important facet of a nicely designed language. Most code comes to life in a rough and unpolished shape, and even more code uses this early, rough and unpolished, code. There *will be* more undecipherable `_ = …` snippets after this proposal has been accepted, that’s for sure. Not as much as I feared initially, fortunately.


More information about the swift-evolution mailing list