<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">strong +1 from me. @warn_unused_result is almost always the right answer in the standard library, and the few cases where it isn’t are very easy to notice (when the call has side-effects and the return value is incidental).<br><div><br></div><div>
-Dave</div></div></blockquote><div><br></div><div>I'm also in favour of this proposal.</div><div><br></div><div>Some days ago, in the swift-dev list ( <a href="https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000385.html">https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20151214/000385.html</a> ) I was advised by Chris Lattner to bring a related issue into this discussion:</div><div><br></div><div>It's about the lack of a warning for simple statements that are unused and thus meaningless (so most probably unintentional). To demonstrate what I mean, here's a short example that currently compiles without any warnings:</div><div><br></div><div><div>func thisFuncHasNoWarnings(a: Int) {</div><div> a</div><div> "b"</div><div> "c" as Character</div><div> 1.0</div><div> [2.0, 3.0]</div><div> ["four", 5, 6.7] as [Any]</div><div> "Is this"; a; "problem?"</div><div>}</div></div><div><br></div><div>I think it might be reasonable to expect a warning on every single line of that function, no?</div><div>/Jens</div><div><br></div></div>
</div></div>