[swift-evolution] [Review] SE-0047 Defaulting non-Void functions so they warn on unused results

Haravikk swift-evolution at haravikk.me
Tue Mar 22 06:12:25 CDT 2016

> On 21 Mar 2016, at 23:21, Adrian Kashivskyy <adrian.kashivskyy at me.com> wrote:
> I believe the scoped @discardableResult(warn|critical) attribute is a nice idea for future directions, but I'm not sure it's in scope of this proposal, which, as a first small step, aims to basically invert the @warn_unused_result standard.
> cc Erica

For the addition of critical sure, but the ability for developers to switch between warn-by-default and ignore-by-default (current) behaviour would ease migration, and address concerns from those that prefer the current behaviour; i.e- for types designed with method chaining in mind the current default is preferable to the new one, and the new default will actually cause those types to become susceptible to the same mistakes that warn-by-default hopes to avoid.

For this reason I think that having an attribute at both function and type levels is important, as it lets developers choose for themselves what the default for their type is (or file, or extension, whatever scope makes most sense).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160322/e2468d99/attachment.html>

More information about the swift-evolution mailing list