<div dir="ltr">Can you guys give me tips on how to improve this PR <a href="https://github.com/apple/swift-evolution/pull/63">https://github.com/apple/swift-evolution/pull/63</a> first time writing a proposal or anything to do with a language. Let me know if there are points I missed.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 12:26 AM, James Campbell <span dir="ltr">&lt;<a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">On second thoughts, I&#39;m preparing one :)</div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 12:24 AM, James Campbell <span dir="ltr">&lt;<a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Cool would be happy for you to do it :)  if you time, almost night here so :) but happy for you to quote me in the proposal.<div><br></div><div><br></div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 16, 2015 at 12:17 AM, Jacob Bandes-Storch <span dir="ltr">&lt;<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Would there be any caveats in introducing something like this, given the raciness of the operator? I guess it&#39;s not really a big deal — the other compound assignment operators (+=, -=, etc.) have the same problem.<div class="gmail_extra"><br></div><div class="gmail_extra">I&#39;m not hearing much argument; sounds like many are in favor. I&#39;d be happy to flesh out my radar into a &quot;??=&quot; proposal this evening, or someone else can do it if they&#39;d like.</div><div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div></font></span><div><div>
<br><div class="gmail_quote">On Tue, Dec 15, 2015 at 4:12 PM, Jordan Rose <span dir="ltr">&lt;<a href="mailto:jordan_rose@apple.com" target="_blank">jordan_rose@apple.com</a>&gt;</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"><div>It&#39;s possible that <a href="https://github.com/apple/swift/blob/master/docs/TransparentAttr.rst" target="_blank">@_transparent</a> is handled early enough in the compiler that we actually would get this behavior. I&#39;m not sure, though.</div><div><br></div><div>+1 from me whether or not didSet is always called, though. &quot;a = a ?? b&quot; always calls didSet anyway.</div><span><font color="#888888"><div><br></div><div>Jordan</div></font></span><div><br></div><div>P.S. There&#39;s nothing particularly useful in the Radar, except that together with the dups there are three suggested spellings: &quot;=?&quot;, &quot;?=&quot;, and &quot;??=&quot;. My vote is with Brent for &quot;??=&quot;.</div><div><div><br><div><blockquote type="cite"><div>On Dec 15, 2015, at 15:26 , James Campbell via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br><div><div dir="ltr" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">:) Wasn&#39;t expecting it to be trivial. but yeah if it could somehow be short circuited so didSet, willSet isn&#39;t called when there is a value already. that would be awesome.<div><br></div><div>Could the willSet, didSet behaviour  be tied to the = behaviour ?  in your example above the operation ultimately cascades into a = operation. </div><div><br></div><div>Same with operations such as *= or /= ultimately it has to do a = operation to set the new calculated value.</div></div><div class="gmail_extra" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 11:23 PM, Jacob Bandes-Storch<span> </span><span dir="ltr">&lt;<a href="mailto:jtbandes@gmail.com" target="_blank">jtbandes@gmail.com</a>&gt;</span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">I agree that would be nice. Just pointing out that it&#39;s nontrivial. If you implement this custom operator today, you get different behavior.<div class="gmail_extra"><span><font color="#888888"><br clear="all"><div><div><div dir="ltr"><div>Jacob<br></div></div></div></div></font></span><div><div><br><div class="gmail_quote">On Tue, Dec 15, 2015 at 3:21 PM, James Campbell<span> </span><span dir="ltr">&lt;<a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>&gt;</span><span> </span>wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">If it has a value already the nit wouldn&#39;t call anything as it technically hasn&#39;t been set. Only if it already has a value does it try and set something in which case the didSet is called :)</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Dec 15, 2015 at 11:16 PM, Jacob Bandes-Storch via swift-evolution<span> </span><span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span><span> </span>wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><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>   <span> </span>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><div dir="ltr"><div>Jacob<br></div></div></div></div><br><div class="gmail_quote"><div><div>On Tue, Dec 15, 2015 at 3:10 PM, Brent Royal-Gordon via swift-evolution<span> </span><span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span><span> </span>wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div><span>&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><font color="#888888"><br>--<br>Brent Royal-Gordon<br>Architechies<br></font></span></div></div><div><div><br><span>_______________________________________________<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></span></div></div></blockquote></div><br></div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=xV0JY-2FdZMnUMvSFtZnLiBPRTDDOSQf3-2FpH33HYOlBxHCmoqblRPu3QCZ5XRZruwnZ-2BGlsSXS7XHFBVRQTA-2B5NKBPecSkEMiEKqvTO5Loxd1XRhCgv-2BUMspC3PpyoJKT32QJ8AjHhSDZoG8JxbSxNRa0gU66lqARiwCJSzRUqw9vcSIIUcROAn9fZ1PyPletwh1fvNW7gUOt2JnzR-2FY7Cea7ouGlsomTcq5O1idJnkvA-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span> </span><br><span>_______________________________________________<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><br></span></blockquote></div><br><br clear="all"><span><div><br></div>--<span> </span><br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div></span></div></blockquote></div><br></div></div></div></div></blockquote></div><br><br clear="all"><div><br></div>--<span> </span><br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div></div><img src="https://u2002410.ct.sendgrid.net/wf/open?upn=ZEz4qHYnXhPr3bBPu-2FxP4tN3HfWKL-2FtJpqkQ0gkOVSABLoYxt-2BlrZpsND7lrKQYYppUVdpvXWp7hXpbAmPQ8h0pggR4LKcAbJRn3Fj1czpatT3DWRw2cYCXCkH6dxPT5JXzIDNynoUqXIEH7Vg2XIBWBpanrFtn-2FUz0bVivgbCWpNwczX6-2FViUfcv9haX6wdmSMJmqQeTDagYNmQsalAPRd9Dk02HRgtzuAQiKfsO6A-3D" alt="" width="1" height="1" border="0" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;min-height:1px!important;width:1px!important;border-width:0px!important;margin:0px!important;padding:0px!important"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"><span> </span>_______________________________________________</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">swift-evolution mailing list</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="mailto:swift-evolution@swift.org" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">swift-evolution@swift.org</a><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br></div></div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div><a href="tel:%2B44%207523%20279%20698" value="+447523279698" target="_blank">+44 7523 279 698</a></div></div></div></div></div></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div><span style="font-size:16px;line-height:19.2px"></span><span style="font-size:12.8px"> Wizard</span><br></div><div><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a></div><div>+44 7523 279 698</div></div></div></div></div></div>
</div>