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

Dave Abrahams dabrahams at apple.com
Thu Feb 25 09:46:41 CST 2016


on Wed Feb 24 2016, Janosch Hildebrand <jnosh-AT-jnosh.com> wrote:

> Thanks for the encouragement everyone! I’ll start drafting over the weekend.
>
> With regard to the inverted attribute, that is definitely open to discussion.
> Other variants that had been mentioned previously include:
>
> @suppress_unused_result - suggested by Adrian Kashivskyy
> @allow_unused_result - suggested by Kevin Ballard
> @ignoreresult - suggested by Brent Royal-Gordon

@no_warn_unused_result would seem to be the least confusable spelling.
@incidental_result would be semantically valid and shorter, but I can't
say I like it.

> Also the aforementioned “Modernizing Attribute Case and Attribute
> Argument Naming” proposal[1] will also play into this discussion as
> well.
>
> [1] https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160215/010510.html
>
> - Janosch
>
>> On 24 Feb 2016, at 21:37, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>> 
>>> On 24 Feb 2016, at 19:27, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>>> 
>>> 
>>> on Wed Feb 24 2016, Chris Lattner <swift-evolution at swift.org> wrote:
>>> 
>>>>> On Feb 24, 2016, at 7:13 AM, Janosch Hildebrand via swift-evolution <swift-evolution at swift.org> wrote:
>>>>> 
>>>>> Erica's proposal about "Modernizing Attribute Case and Attribute
>>>>> Argument Naming" made me remember this discussion.
>>>>> 
>>>>> I don't think a proposal was ever submitted? If no one else is
>>>>> working on a proposal already I would offer myself up for writing
>>>>> this up.
>>>> 
>>>> I don’t recall a real proposal, it would be great for you to drive this.
>>> 
>>> Yes, please!  I *really* want this change.
>> 
>> Same!
>> 
>> The only thing that needs to be considered is what to name the
>> replacement attribute (for methods where the return value isn’t
>> important). I’m thinking @optionalReturn or @ignoreUnusedResult or
>> such.
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

-- 
-Dave


More information about the swift-evolution mailing list