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

Dave Abrahams dabrahams at apple.com
Thu Mar 24 20:04:33 CDT 2016

on Thu Mar 24 2016, Andrey Tarantsov <swift-evolution at swift.org> wrote:

>>> The new default is better for:
>>> - (A) classes that provide both mutating and non-mutating methods;
>>> - (B) methods where forgetting to use the result produces a bug (a
>>> download task that needs to be resumed, an alert that needs to be
>>> displayed, a listener that needs to be stored somewhere, etc).
>> To be clear, the mistake this warning prevents is the unintentional call
>> to a non-mutating method when one thinks one is mutating the receiver.
>> This scenario can arise independently of A or B.
> Sure. Although if a type only has mutating or non-mutating methods,
> but not both, the mistake will probably be immediately apparent, 

Why do you think so?

> so the diagnostic doesn't win you much (except maybe in a newbie
> learning environment, which is an important use case as well).
> A.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list