[swift-evolution] [swift-evolution-announce] [Review] SE-0047 Defaulting non-Void functions so they warn on unused results
swift-evolution at haravikk.me
Thu Mar 17 05:39:05 CDT 2016
> On 17 Mar 2016, at 09:27, Tino Heth via swift-evolution <swift-evolution at swift.org> wrote:
> Sadly, the second sentence is definitely true — "@discardableResult" doesn't "feel" right, and would discourage techniques like fluent interfaces.
Somehow I completely forgot about the issue around naming the replacement attribute; I agree that it doesn’t feel right, but then @warn_unused_result doesn’t feel that right to me either.
I’m very much more in favour of decorating the return type itself as mentioned in alternatives. In fact, I’d be in favour of delaying this change until that can be done, rather than using something else in the mean time; I do want this change, but it’s not such a big deal to me that I’m unwilling to wait a little bit longer to get what I feel is the better form of it.
If it does go ahead though, I think that in the short term @ignore_unused_result is more consistent with what we have now, and can be re-evaluated depending upon what we want to do with the attribute naming convention (or has that been decided already?). While it’s longer, I think that any variation of "ignore unused” is a bit clearer than discardable, at least to me.
More information about the swift-evolution