[swift-evolution] Make non-void functions @warn_unused_result by default
adrian.kashivskyy at me.com
Thu Dec 10 17:30:43 CST 2015
Matthew, I actually like your idea better than using an opposite "@suppress_unused_result" attribute. In addition, it will even be easier to implement, since "let _" syntax is already supported in the language.
Pozdrawiam – Regards,
> Wiadomość napisana przez Matthew Johnson <matthew at anandabits.com> w dniu 11.12.2015, o godz. 00:28:
> Why should unused results be acceptable? Why not require callers to explicitly throw away the result:
> let _ = funcReturningValueThatIsIgnored()
> Yes this is extra syntax, but it also makes it clear that the value was intended to be ignored and the function was only executed for side-effects.
>> On Dec 10, 2015, at 5:23 PM, Guillaume Lessard via swift-evolution <swift-evolution at swift.org> wrote:
>>> On 10 déc. 2015, at 15:58, Adrian Kashivskyy via swift-evolution <swift-evolution at swift.org> wrote:
>>> I think non-void functions should warn about their return value being unused by default, thus eliminating the need to attribute them with @warn_unused_result.
>> I strongly don’t like this idea. This being said, if it happens ann attribute that says "unused result are acceptable" must be created. Makes me wince.
>> Guillaume Lessard
>> swift-evolution mailing list
>> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution