<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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="">On 17 Mar 2016, at 09:27, Tino Heth via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> 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>Ack, hit send before quoting this part to come back to it.</div><div><br class=""></div><div>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><br class=""></div><div>Perhaps we could add some kind of attribute to the type itself to allow for selection between the two behaviours?</div><div><br class=""></div><div>For example, we could use a different attribute in the style of:</div><div><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div><font face="Monaco" class="">@unusedResult(ignore)</font></div><div><font face="Monaco" class="">@unusedResult(warn)</font></div></blockquote><div><br class=""></div><div>Add this to a function and it affects that specifically, add it to a type and it affects all methods of that type (unless they have their own attribute overriding it). So for a fluent interface I could do:</div><div><br class=""></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>@unusedResult(ignore)</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>protocol MyFluentType {</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>func something() -> Self</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>func somethignElse() -> Self</font></div><div><font face="Monaco" class=""><br class=""></font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>@unusedResult(warn)</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">                </span>func notAFluentMethod() -> Self</font></div><div><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>}</font></div><div><font face="Monaco" class=""><br class=""></font></div><div>If we do get return type attributes then the return type form could become @unused(ignore) to make it a bit shorter?</div></body></html>