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

Yuta Koshizawa koher at koherent.org
Thu Mar 17 18:21:37 CDT 2016


>         • What is your evaluation of the proposal?

+1

Although I am not perfectly sure, I think it may be better to raise an
error instead of a warning when the code lacks both
`@discardableResult` and consuming a return value . When someone gets
the warning, we expect them to consume the result or ignore it
explicitly by `_ =`. If they keep the warning, it will make it easier
to miss other warnings. It is undesirable. Unlike other warnings, I
can't think of any good cases in which they should keep their codes
with the warning. If we always expect them to modify their codes,
raising an error seems better.

>         • Is the problem being addressed significant enough to warrant a change to Swift?

Yes. I think it will not give so large impact on existing codes and
syntax. The benefits are relatively larger enough.

>         • Does this proposal fit well with the feel and direction of Swift?

Yes. It will make our codes cleaner and safer. I think that is the
direction of Swift. I feel `@discardableResult` is natural.

>         • If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

I think I have not used other languages with a similar feature.

>         • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

A quick reading. I also roughly searched the discussion for something
about warning/error and I found nothing.

-- Yuta


More information about the swift-evolution mailing list