<div dir="ltr">One possible caveat is with custom setters.<div><br></div><div>If &quot;a&quot; already has a value, does &quot;a ??= b&quot; call the custom setter/willSet/didSet, or does it see the nil and short-circuit?</div><div><br></div><div>This can be implemented today:</div><div><br></div><div>    func ??=(inout lhs: T?, @autoclosure rhs: () -&gt; T?) { if lhs == nil { lhs = rhs() } }</div><div><br></div><div>However, the use of &quot;inout&quot; will always cause the didSets to be triggered at the call site, when just using if-statements instead wouldn&#39;t have done so.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div>Jacob<br></div></div></div></div>
<br><div class="gmail_quote">On Tue, Dec 15, 2015 at 3:10 PM, Brent Royal-Gordon via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">&gt; I think that the existing syntax for “??” handles this need fairly well without requiring an additional assignment operator:<br>
&gt;<br>
&gt;       a = a ?? []<br>
<br>
</span>When the variable is `a`, sure. When it’s `scoreboardViewController.selectedScoreboard`, not so much.<br>
<br>
+1 from me, though I prefer the `??=` spelling to match the `??` operator more closely.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Brent Royal-Gordon<br>
Architechies<br>
</font></span><div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div></div>