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

Chris Lattner clattner at apple.com
Thu Feb 25 17:31:36 CST 2016

On Feb 25, 2016, at 7:49 AM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>> https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160215/010510.html
>>> <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160215/010510.html>
>>> - Janosch
>> While I like the brevity, I don’t think @ignoreresult is clear enough
>> on what it does, @optional_result (or ideally @optionalResult if
>> camel-case for attributes is accepted) is clearer I think if we want a
>> shortened two-word form. Or there’s Sean’s @discardable_result
>> alternative which is even clearer.
>> Otherwise @allow_unused_result is the best of the three word options I
>> think; @suppress_unused_result is a bit unclear as what you’re
>> actually suppressing is the compiler warning, as in most cases a
>> result will still be generated, it’s just not stored anywhere at the
>> call site.
> @discardable_result is nice.  I kinda wish it were an annotation on the result
> type; then it could just be @discardable.

+1 for @discardable on the result.


More information about the swift-evolution mailing list