[swift-evolution] [Review] SE-0047 Defaulting non-Void functions so they warn on unused results
brent at architechies.com
Thu Mar 17 04:02:02 CDT 2016
>> I also don't like that this proposal doesn't include an "Impact on existing code" section. We ought to decide whether the migrator will add `@discardableResult` to existing symbols or not.
> I totally agree with Erica – the migrator should only remove existing @warn_unused_result attributes. @discardableResult should be added manually and deliberately to functions in stdlib and your own code. We'll be happy to clarify this behavior under "Impact on existing code" section.
I agree in general, but I'm sure there are at least one or two codebases out there which really *have* been thoroughly audited and their authors will be highly displeased to have to update them manually. We might want to provide an option to invert the existing annotations, or to invert things automatically if the code meets some heuristic, like having more than half of the functions in a given file marked with `@warn_unused_result`.
More information about the swift-evolution