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

Paul Ossenbruggen possen at gmail.com
Wed Feb 24 23:19:59 CST 2016


These lack conciseness. What about the already supported: 

let _ = ingoreResult()

Where ignoreResult is the function. Or maybe something even more brief? What was wrong with (void)? or 

	(_)ingoreResult()

- Paul 


> On Feb 24, 2016, at 8:42 PM, Charles Kissinger via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On Feb 24, 2016, at 7:12 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> I'd rather have something clear than short.
>> 
>> Some short ones that haven't been mentioned:
>> @Statement has a problem because the result can be used, it's just not mandated. 
>> @Statementable just makes no English sense at all (similarly @Procedurable) but kind of communicates the idea
>> @ResultDiscardable: not a fan
>> @StatementAllowed or @AllowStatement really doesn't make a ton of sense, but it's short and kind of gets the point across.
>> @SideEffects also short, also kind hints at stuff, also could be misleading, and the same for @HasSideEffects.
>> My favorite remains @SuppressUnusedResultWarning, which isn't short but pretty damn clear.
> 
> +1. This would be my choice as well. It is the warning that is affected, not the result, so “Warning” or “NoWarn” should be in the name.
> 
> —CK
> 
>>  
>> 
>>> On Feb 24, 2016, at 7:32 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>>> @optional_result (or ideally @optionalResult if camel-case for attributes is accepted) is clearer I think if we want a shortened two-word form.
>>> 
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160224/5caa1d18/attachment.html>


More information about the swift-evolution mailing list