<div dir="ltr"><span class="im"><blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><li style="margin-left:15px">What is your evaluation of the proposal?<br></li></ul></blockquote></span><div>-1. Kevin Ballard seems to have covered my reasons quite well.<br></div><span class="im"><div> </div><blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><li style="margin-left:15px">Is the problem being addressed significant enough to warrant a change to Swift?<br></li></ul></blockquote></span><div>No. Again, Kevin Ballard has covered it. I think it encourages mutability where it's not necessary, isn't useful without a return value, and syntactically doesn't add much over `??`.</div><span class="im"><blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><li style="margin-left:15px">Does this proposal fit well with the feel and direction of Swift?<br></li></ul></blockquote></span><div>I think it adds unnecessary syntactic sugar and encourages bad (swift) practices, which doesn't fit the feel and direction of Swift. I can understand the desire for it, but every time I've wanted it I have used ?? and preferred the resulting code. The resulting code has felt more Swifty. I suppose worst-case you can do this: `<font face="monospace, monospace">a = b ?? a</font>`.</div><span class="im"><blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><li style="margin-left:15px">If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></li></ul></blockquote></span><div>Other languages I've used have allowed this operator to be chained, used as a style of lazy-initialization. Using this operator for that doesn't guarantee that the value is set, and set once, there's better ways to do that in Swift. Other cases I've seen it were to break expressions over multiple lines, I think that's noisy, and prone to mistakes when refactoring.</div><span class="im"><blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'"><li style="margin-left:15px">How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></li></ul></blockquote></span><div>Followed the discussion, read the proposal, read the last post (Kevin's).</div><div><br></div><div>- Andrew Bennett</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 17, 2016 at 2:26 PM, Kevin Ballard via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div><span class=""><div>On Fri, Feb 12, 2016, at 09:15 PM, Douglas Gregor wrote:<br></div>
<blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)"><li>What is your evaluation of the proposal?<br></li></ul></blockquote></span><div>-1. If we were to have this operator, then I think `??=` is a good choice for it. But I don't think we need this operator. As others have pointed out, a lot of the use-cases from other languages don't actually work in Swift, and having the operator encourages people to write anti-patterns in order to use it, such as making a value into a mutable Optional when it really should be an immutable non-optional value.<br></div><span class="">
<div> </div>
<blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)"><li>Is the problem being addressed significant enough to warrant a change to Swift?<br></li></ul></blockquote></span><div>No. The need for this sort of operator is much rarer in Swift than it is in languages that do have an equivalent (like Ruby).<br></div>
<div> </div>
<div>Anecdotally, I've written a lot of Swift code at this point, and I've never wanted this. I have on rare occasion wanted a local "lazy" variable, but in those rare instances, the desire was to move the initialization out of the main body of the function and up to the declaration, which `??=` doesn't help with.</div><span class="">
<div> </div>
<blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)"><li>Does this proposal fit well with the feel and direction of Swift?<br></li></ul></blockquote></span><div>The choice of operator I think is reasonable, given the existing `??` operator, but encouraging the use of Optionals for local variables that will end up with a guaranteed-non-Optional value does not.</div><span class="">
<div> </div>
<blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)"><li>If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></li></ul></blockquote></span><div>The only languages that I know of with a similar operator also return the rhs value from the assignment expression, and that's not something Swift would do. So this is less useful than the operator in those languages.</div><span class="">
<div> </div>
<blockquote type="cite"><ul style="padding:0px 0px 0px 2em;margin-top:0px;margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)"><li>How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></li></ul></blockquote></span><div>A quick reading.<br></div>
<div> </div>
<div>-Kevin Ballard</div>
</div>
<br>_______________________________________________<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/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>