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

Dan Raviv dan.raviv at gmail.com
Thu Mar 17 14:09:43 CDT 2016


>       • What is your evaluation of the proposal?
+1 for default error/warning on ignoring returned value in regular code, -1 for 
this behavior in playgrounds.

In production code, ignored return values are rare. In the cases where they are 
ignored, prepending "_ =" makes the code clearer and more explicit.
In research code (playgrounds), as mentioned in the proposal, it's common to 
write expressions just to see the evaluated result. Having to prepend "_ =" 
everywhere would be bothersome and clutter the code. I guess it would make sense 
to allow opting-in to this behavior in playgrounds.

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

Yes, it will remove an entire class of bugs.

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

A quick reading.


More information about the swift-evolution mailing list