<div dir="ltr">On 15 October 2017 at 14:23, Geordie Jay <span dir="ltr"><<a href="mailto:geojay@gmail.com" target="_blank">geojay@gmail.com</a>></span> wrote:<br><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-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Hi Mike,</div><div class="gmail_extra"><br><div class="gmail_quote"><span class="gmail-">2017-10-15 14:55 GMT+02:00 Mike Kluev <span dir="ltr"><<a href="mailto:mike.kluev@gmail.com" target="_blank">mike.kluev@gmail.com</a>></span>:<br><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 dir="ltr"><span class="gmail-m_-5303066719502610215gmail-">On 15 October 2017 at 13:35, Geordie Jay <span dir="ltr"><<a href="mailto:geojay@gmail.com" target="_blank">geojay@gmail.com</a>></span> wrote:</span><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-m_-5303066719502610215gmail-"><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 dir="ltr"><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></blockquote><div><br></div></span><div>you can't write this either:</div><div><br></div><div>let something: inout Bool = true</div><div><br></div><div>that doesn't mean "inout" should be "@inputOutput" before the parameter name in function signature.</div></div></div></div></blockquote><div><br></div></span><div>This is a different case: inout is an annotation on argument types (of which there can be many).</div></div></div></div></blockquote><div><br></div><div>i mean:</div><div><br></div><div>@discardableResult func foo(@inputOutput x: Int, @inputOutput y: Float) -> Bool </div><div><br></div><div>vs:</div><div><br></div><div>func goo(x: inout Int, y: inout y) -> discardable Bool</div><div><br></div><div>i deliberately mixed the current @discardableResult syntax with a hypothetical "consistent" @inputOutput syntax to make my point more clear. to me these use cases are virtually the same, and syntax shall be consistent among them.</div><div> </div><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't understand what you're saying here. "Now in swift 0.0"? The first public version of Swift had this same functionality in its same form, with the name @warn_unused_result. The current version is just reversed, which to me is a logical change.</div></div></div></div></blockquote><div><br></div><div>in other words: "if we didn't have swift already what would I do" kind of test. similar to the one that we already officially use: "if it wasn't done already, would we do it now" to prune rarely used language constructs.</div><div><br></div><div>remember the evolution of the "inout" keyword:</div><div><br></div><div>(inout x: Int) ---> "var parameters dropped" + (x: inout Int)</div><div><br></div><div>similarly, it's not unimaginable to consider this evolution as well:</div><div><br></div><div>"@warn_unused_result func" --> "@discardableResult func" --> "func foo() -> discardable Bool"<br></div><div> </div><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-"><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>throwing func foo() -> Bool</div></div></div></div></blockquote><div><br></div></span><div>I personally like that syntax, because that's exactly how I <i>talk</i> about such a function. "oh that's a throwing function so you need to call it with <b>try</b>".</div></div></div></div></blockquote><div><br></div><div>you are the first who +1-ed it so far, so we now have +2 in total for "throwing".</div><div> </div><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>As an extension to that, I'd also say "you can call that function without a preceding variable assignment because it has a discardable result". I would never say "this function returns a discardable boolean" because that just doesn't match my mental model of what's going on. To me, it's the <i>function</i> whose return value can be discarded — in theory it has nothing to do with the result itself. But it's quite possible I'm in the minority here.</div></div></div></div></blockquote><div><br></div><div>to me it's trivial:</div><div><br></div><div>func foo() -> Bool - means "function foo returning result of type Bool"</div><div><br></div><div>ditto:</div><div><br></div><div><div>func foo() -> discardable Bool - means "function foo returning result of type Bool that can be unused by the caller"</div></div><div><br></div><div>very compatible with:</div><div><br></div><div>foo(x: inout Bool) - means input / output parameter x that is of type Bool</div><div><br></div><div>if you don't complain about the latter (like: "how come Bool is input output?! it is the parameter that is input / output, not the Bool itself !!!" or, similarly: "how come the function returns type Never? the function just never returns but the type shall be Void !!!") then I don't see why you don't accept the former.</div><div><br></div><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 dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="gmail-HOEnZb"><font color="#888888"><div><span style="color:rgb(34,34,34)">But it's quite possible I'm in the minority here.</span></div></font></span></div></div></div></blockquote><div><br></div><div>as a matter of fact, so far it looks I am :)</div><div><br></div><div>Mike</div><div><br></div><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">
</blockquote></div></div></div>