<div dir="ltr">This is less desirable than ??= would have been. To summarise the two operators:<div><br></div><div>lhs ??= rhs. lhs is an Optional<T>, rhs is a T or Optional<T>.</div><div>If lhs is nil, assign to lhs the value of rhs. If lhs is not nil, do nothing.</div><div><br></div><div>lhs := rhs. lhs is an Optional<T>, rhs is a T or Optional<T>.</div><div>If lhs is nil, assign to lhs the value of rhs. If lhs is not nil, crash with an assertion error.</div><div><br></div><div>The ??= operator is safer; its behaviour is clear and it doesn't cause my code to crash. := is more dangerous; if I want to be sure my app won't crash, I now need to check whether lhs is nil first... and if I do that, I might as well use the = operator.</div><div><br></div><div>I don't see what advantages your operator brings to Swift, or why you think it should be accepted when ??= operator was rejected.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 27, 2016 at 2:47 PM, Amir Michail <span dir="ltr"><<a href="mailto:a.michail@me.com" target="_blank">a.michail@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><br><div><span class=""><blockquote type="cite"><div>On Feb 27, 2016, at 9:46 AM, Ross O'Brien <<a href="mailto:narrativium+swift@gmail.com" target="_blank">narrativium+swift@gmail.com</a>> wrote:</div><br><div><div dir="ltr">How is this different from the rejected ??= proposal?</div><div class="gmail_extra"><br></div></div></blockquote><div><br></div></span><div>If the value is not nil, the program stops with an assertion error.</div><span class=""><div><br></div><blockquote type="cite"><div><div class="gmail_extra"><div class="gmail_quote">On Sat, Feb 27, 2016 at 2:34 PM, Amir Michail 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">Consider the use of “!” in the following:<br>
<br>
var x: Int? = 5<br>
<br>
x! = 2 // “!” is used to ensure non-nil value before assignment<br>
<br>
The idea is to have a similar method for ensuring a nil value.<br>
<br>
So instead of writing:<br>
<br>
precondition( x == nil )<br>
x = 3<br>
<br>
You could write:<br>
<br>
x := 3<br>
<br>
_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">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>
</blockquote></div><br></div>
</div></blockquote></span></div><br></div></blockquote></div><br></div>