<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div></div><div>-1 to the proposal.</div><div><br></div><div>Kevin and others have summed up the reasons already: the operator is encouraging mutability and optionality where it would not be needed and using it therefore seems to be an anti pattern. </div><div><br></div><div>-Thorsten </div><div><br>Am 17.02.2016 um 06:26 schrieb Kevin Ballard via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>>:<br><br></div><blockquote type="cite"><div>
<title></title>
<div>On Fri, Feb 12, 2016, at 09:15 PM, Douglas Gregor wrote:<br></div>
<blockquote type="cite"><ul style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left: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';font-size:16px;background-color:rgb(255, 255, 255);"><li style="">What is your evaluation of the proposal?<br></li></ul></blockquote><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>
<div> </div>
<blockquote type="cite"><ul style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left: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';font-size:16px;background-color:rgb(255, 255, 255);"><li style="">Is the problem being addressed significant enough to warrant a change to Swift?<br></li></ul></blockquote><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>
<div> </div>
<blockquote type="cite"><ul style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left: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';font-size:16px;background-color:rgb(255, 255, 255);"><li style="">Does this proposal fit well with the feel and direction of Swift?<br></li></ul></blockquote><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>
<div> </div>
<blockquote type="cite"><ul style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left: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';font-size:16px;background-color:rgb(255, 255, 255);"><li style="">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><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>
<div> </div>
<blockquote type="cite"><ul style="padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left: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';font-size:16px;background-color:rgb(255, 255, 255);"><li style="">How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></li></ul></blockquote><div>A quick reading.<br></div>
<div> </div>
<div>-Kevin Ballard</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution mailing list</span><br><span><a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br></div></blockquote></body></html>