[swift-evolution] Proposal: x == 2 should not be a valid statement

Haravikk swift-evolution at haravikk.me
Thu Feb 11 17:57:52 CST 2016


> On 11 Feb 2016, at 23:52, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This should be covered by the standard library making `==` @warn_unused_result and/or the language making @warn_unused_result the default behavior for all declarations.

I agree with this. I have kind of wondered why @warn_unused_result isn’t actually the default, as I forget to add it nine times out of ten, when in reality almost all of my methods that return something should have it. Is there an existing discussion for switching the behaviour?

But yeah, I think warning of unused comparison results should solve this issue well enough, just like misusing a function/method call.


More information about the swift-evolution mailing list