<div dir="ltr"><div>Hello,</div><div><br></div>While I can see the recommended change as "nice" at some level, I don't really see much practical advantage to it. The criticism of the status quo seems to be based around aesthetics. I think aesthetics of the current version are fine, given you can put the attribute on the previous line, like this:<div><br></div><div><b>@discardableResult</b></div><div><b>public mutating func thatIsSoLongthatWeNeedToPutSomethingOnTheNextLine() -> Bool {</b></div><div><b><br></b></div><div><b>}</b></div><div><br></div><div>I personally find that more readable than the alternative.</div><div><br></div><div><br></div><div>Also we're not talking about whether the Bool itself is discardable. For example, it makes no sense to write:</div><div><br></div><div><b>let something: discardable Bool = true</b></div><div><br></div><div><br></div><div>There has been some discussion of "throws" as a keyword. If anything I think that is something that is in more need of change. I've always read it (frustratingly) as e.g. "func throws Bool", which it doesn't, it throws an Error.</div><div><br></div><div>My 2c.</div><div><br></div><div>- Geordie</div><div><br></div><div><br></div><div class="gmail_extra"><br><div class="gmail_quote">2017-10-14 0:27 GMT+02:00 Mike Kluev via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class="">On 13 October 2017 at 22:50, Jean-Daniel <span dir="ltr"><<a href="mailto:mailing@xenonium.com" target="_blank">mailing@xenonium.com</a>></span> wrote:</span><div><br><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div>I mean:</div><div><br></div><div>func foo() -> Int { … }</div><div><br></div><div>func bar(callback: () -> discardable Int) { … }</div><div><br></div><div>bar(foo) // does it warns ?</div><div>bar({ 3 }) // does it warns ? If it does, how to avoid it ?</div></div></blockquote><div><br></div></span><div>thanks.</div><span class=""><div><br></div><div><span style="font-size:12.800000190734863px">>>> And allowing it in signature but not in lambda would be confusing.</span><br></div><div><span style="font-size:12.800000190734863px"><br></span></div></span><div><span style="font-size:12.800000190734863px">not any more confusing than</span><span style="font-size:12.800000190734863px"> it is now (</span><span style="font-size:12.800000190734863px">allowing @discardableResult before function name and not allowing it before closure parameters)</span><span style="font-size:12.800000190734863px">.</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">but, if to fix that, than could be this (orthogonal to whether it is "@discardableResult" or "discardable"):</span></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><div><div>func foo() -> Int {}</div><div>func bar(_ callback: () -> discardable Int) {}</div><div><br></div><div>bar(foo)<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>// error, type mismatch</div><div>bar({ 3 })<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>// error, type mismatch</div><div>bar({ () -> discardable Int in 3 })<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>// ok, types matched</div><div><br></div><div>- and - </div><div><br></div><div>func poo() -> discardable Int {}</div><div>func baz(_ callback: () -> Int) {}</div><div><br></div><div>baz(poo)<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>// ok, types compatible</div><div>baz({ 3 })<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                        </span>// ok, types matched</div><div>baz({ () -> discardable Int in 3 })<span class="m_9157122556944748372gmail-Apple-tab-span" style="white-space:pre-wrap">                </span>// ok, types compatible</div></div></div><div><br></div><div>Mike</div><div><br></div></div></div></div></div>
<br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>