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

Erica Sadun erica at ericasadun.com
Thu Mar 17 20:36:40 CDT 2016

> On Mar 17, 2016, at 7:15 PM, William Shipley via swift-evolution <swift-evolution at swift.org> wrote:
> Strong +1, with some nitpicks to enclosed example:
> I disagree that NSNotificationCenter’s returned token should be ignored without warning—this goes against the patterns I’ve seen in programming Cocoa the last 27 years, where needing to unregistering for notifications when an object is unloaded is more common than registering once and leaving it for the lifetime of the app.

NSObservervationCenter example: should not be marked. Most observer lifetimes will be shorter than the application's lifetime and view controllers should clean up after themselves when dismissed, hidden, or otherwise put away. The compiler should emit warnings about this use that the developer must override.

Are you sure we are disagreeing?

-- E

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160317/0ff96378/attachment.html>

More information about the swift-evolution mailing list