<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 17 mars 2016 à 06:50, Haravikk via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On 17 Mar 2016, at 09:27, Tino Heth via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div></blockquote><blockquote type="cite" class=""><div class="">Have a look at <a href="http://www.martinfowler.com/bliki/FluentInterface.html" class="">http://www.martinfowler.com/bliki/FluentInterface.html</a> for a good reason to keep "results" discardable.</div></blockquote><br class=""></div><div class="">Ack, hit send before quoting this part to come back to it.</div><div class=""><br class=""></div><div class="">I assume your point here is that having to add @discardableResult (or whatever) will lead to fluent interfaces becoming prone to the same mistakes that non-fluent interfaces currently have with @warn_unused_result.</div><div class=""><br class=""></div><div class="">Perhaps we could add some kind of attribute to the type itself to allow for selection between the two behaviours?</div><div class=""><br class=""></div><div class="">For example, we could use a different attribute in the style of:</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><font face="Monaco" class="">@unusedResult(ignore)</font></div><div class=""><font face="Monaco" class="">@unusedResult(warn)</font></div></blockquote></div></div></blockquote><div><br class=""></div>If we go with something like this, we may want to also have a:</div><div><br class=""></div><div>@unusedResult(critical)</div><div><br class=""></div><div>Which generate error for unused result, and a warning when assigning the result to &nbsp;_.</div><div>This could be useful for function which return allocated resources, which is a return code that should never be ignored even explicitly.</div><div><br class=""></div><div>Dany</div><br class=""></body></html>