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

Brent Royal-Gordon brent at architechies.com
Wed Mar 2 18:13:38 CST 2016


> My primary preference is to just say that's the way it is. I don't particular like any of the attributes. Also, we have a mechanism to discard the result already:
> 
> let _ = discardableResult()

Do you really want to require that for, say, `RangeReplaceableCollectionType.removeLast()`? Because that's what this implies.

I don't think that's a good idea. It would make the warning more noisy, which would ultimately make it meaningless.

> For resiliency, is adding a `@discardable` attribute a breaking change? Removing it?

If it has any resiliency implications at all, removing it would break. But I don't think it would; it merely controls a warning, and doesn't necessarily imply any change in semantics.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list