[swift-evolution] Make non-void functions @warn_unused_result by default
kevin at sb.org
Mon Dec 21 12:53:56 CST 2015
At this point I think it's worth actually finding out how much code this
would impact in practice. Not just in the stdlib, but in third-party
applications and libraries.
This could be done by putting this feature into the language, but
requiring a swiftc flag to turn it on. The stdlib would have to be
annotated with @allow_unused_result (or whatever we call it) in the
right places, such as in pop(), but I suspect that there's relatively
few APIs in the stdlib that need this annotation.
We can then tell people to try adding the flag and seeing how many
warnings they get in their code, and to then figure out how many of the
warnings are potentially useful (e.g. methods where it's reasonable to
have the warning even if the code wants to ignore it at that moment) vs
how many are bad (such as pop(), where ignoring the return value is
perfectly reasonable in many cases). Similarly, someone could run this
flag against same projects for popular third-party libraries and see
what pops up.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution