<html><head></head><body>async is a keyword where as @discardableResult is an attribute. This pitch does not include any advantages over the current form. In fact this will rather harm the readbility because you no longer can nicely put the annotation above the function and it won’t play well with other keywords like throws, rethrows and async.<div><br></div><div>@discardableResult</div><div>funx foo() { /* ... */ }</div><div><br></div><div>So -1 for this pitch.<br><div class="bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <p class="gmail_quote" style="color:#000;">Am 9. Oktober 2017 um 18:02:14, Dave DeLong via swift-evolution (<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="gmail_quote"><span><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div></div><div>
<title></title>
Oooo, I really like this.
<div class=""><br class=""></div>
<div class="">It also brings up an interesting point on the whole
async discussion. Doesn’t the async apply to the <i class="">return
value</i> and not the other stuff?</div>
<div class=""><br class=""></div>
<div class="">IE instead of:</div>
<div class=""><br class=""></div>
<div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">async func getBool() →
Bool</span></font></div>
<div class=""><br class=""></div>
<div class="">It could be:</div>
<div class=""><br class=""></div>
<div class=""><font face="Menlo" class=""><span style="font-size: 11px;" class="">func getBool() → async
Bool</span></font></div>
<div class=""><br class=""></div>
<div class="">Dave<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Oct 9, 2017, at 9:58 AM, Fil Ipe via
swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">I find it extremely cumbersome to have
to precede a function declaration with such an extensive
annotation such as @discardableResult</span><br class=""></div>
<div style="font-size:12.8px" class=""><br class=""></div>
<div style="font-size:12.8px" class="">Now that so many functions
do need this annotation to be there, our code became so ugly.</div>
<div style="font-size:12.8px" class=""><br class=""></div>
<div style="font-size:12.8px" class="">Besides, having this
annotation precede the function declaration kind of reminds me of C
rather than Swift. <span style="font-size:12.8px" class="">Since in C the</span><span style="font-size:12.8px" class=""> function declarations started by the type of the return
value.</span></div>
<div style="font-size:12.8px" class=""><br class=""></div>
<div style="font-size:12.8px" class="">I, therefore, think it
would be much softer on the eye, and much more precise in intent,
to instead precede the result of a func with a
simpler and shorter @discardable annotation</div>
<div style="font-size:12.8px" class=""><br class=""></div>
<div style="font-size:12.8px" class="">So it would be:</div>
<div style="font-size:12.8px" class=""><br class=""></div>
<span style="font-size:12.8px" class="">func() -> @discardable
Bool { } </span>
<div style="font-size:12.8px" class="">
<div class=""><br class=""></div>
<div class="">Rather than: </div>
<div class=""><br class=""></div>
<div class="">@discardableResult func() -> Bool { } </div>
<div class="">
<div class=""><br class=""></div>
<div class="">It could be even better if someone could perhaps find
a shorter word that is a synonym for the word "discardable", that
would be as explicit in intent as the word "discardable" is in such
context, yet be written with fewer characters.</div>
</div>
<div class=""><br class=""></div>
</div>
<div style="font-size:12.8px" class="">Swift regards,</div>
<div style="font-size:12.8px" class="">Filipe Sá.</div>
</div>
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div>
</blockquote>
</div>
<br class=""></div>
_______________________________________________<br>swift-evolution mailing list<br>swift-evolution@swift.org<br>https://lists.swift.org/mailman/listinfo/swift-evolution<br></div></div></span></blockquote>
</div></body></html>