<div dir="ltr">Interesting what if instead of ??? it was ?! (Take an optional "?", unwrap to a default value if needed "!" and set it "=")<br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">
<p><b><font color="#cc0000">___________________________________</font></b></p><p><b>James⎥Head of Awesome</b></p><p><b><font color="#cc0000"><a href="mailto:james@supmenow.com" target="_blank">james@supmenow.com</a>⎥<a href="http://supmenow.com" target="_blank">supmenow.com</a></font></b></p><p><b><font size="2">Sup</font></b></p><p><b><font size="2">Runway East
</font></b></p><p><b><font size="2">10 Finsbury Square</font></b></p><p><b><font size="2">London</font></b></p><p><b><font size="2">
EC2A 1AF </font></b></p></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Feb 18, 2016 at 2:14 AM, Ross O'Brien 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"><div dir="ltr"><span style="font-size:13px">> • What is your evaluation of the proposal?</span><br><div><br></div><div>I'm for the adoption of this operator.</div><div><br></div><div>Acknowledging previous comments: Swift values non-optional and immutable types, but I don't see this operator as encouraging optionals or mutable types; instead I see it as one step in the process of make clearer how mutable optionals are used. They aren't going anywhere.</div><div><br></div><div>The difficulties of '??=' lie with '??', because it's overloaded; it serves both of these signatures:</div><div>1) Optional<T> ?? Optional<T> -> Optional<T></div><div>2) Optional<T> ?? T -> T</div><div>If we disambiguated this operator - for the sake of example, replaced the operator in 1) with '???' and kept 2) as is - then '??=' would be meaningless (its left argument would never be optional) and this proposal would instead be for the inclusion of '???=', which would be unambiguous. And the number of question marks alone would drown the developer in doubt until they went for the straightforward non-optional constant others in this thread feel this operator would encourage.</div><div><br></div><div>As a further suggestion: just as the Swift compiler will currently warn a developer that a local variable is unused (and suggest replacing it with '_') or that a variable doesn't change (and suggest replacing its declaration with '??'), perhaps it could be possible to identify situations where an optional var could be replaced with a non-optional let if a '??=' statement was rewritten as '??', and issue an appropriate warning.<br></div><div><br></div><div><span style="font-size:13px">> • Is the problem being addressed significant enough to warrant a change to Swift?</span><br style="font-size:13px"><br>Swift encourages non-optionals. This isn't a significant problem, particularly if one follows the law of Demeter as one codes. But it's a nice addition.<br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">> • Does this proposal fit well with the feel and direction of Swift?</span><br style="font-size:13px"><br>Yes. Swift will continue to have optionals, and code handling optionals should be clear. As long as the meaning of ?? is clearly understood, ??= will be.<br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">> • If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</span><br style="font-size:13px"><br style="font-size:13px">I haven't used a similar feature in other languages, but have previously wished for such an operator in Objective C (prior to its nullable/nonnullable additions).<br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">> • How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</span><br></div><div><span style="font-size:13px"><br></span></div><div>I've read the proposal and much of the swift-evolution discussion of it.</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 17, 2016 at 5:47 PM, Tal Atlas 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"><div dir="ltr">I think that overall this is a good operator that eventually should get in. At this point though the wins that this would bring are probably not worth the added complexity to the language.<div><br></div><div>As Joe said the primary use case for the hammer operator `||=` in ruby is not even covered by this operator, so it’s use would be far more limited than in those languages.</div></div><div class="gmail_extra"><br clear="all"><div><div>-Tal</div></div>
<br><div class="gmail_quote"><div><div>On Sat, Feb 13, 2016 at 12:15 AM, Douglas Gregor via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div style="word-wrap:break-word"><p style="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)">Hello Swift community,</p><p style="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)">The review of SE-0024 "Optional Value Setter `??=`" begins now and runs through February 18, 2016. The proposal is available here:</p><blockquote style="margin:0px 0px 16px;padding:0px 15px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);background-color:rgb(255,255,255)"><div style="margin-top:0px;margin-bottom:0px"><font color="#777777" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3"><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md</a></font></div></blockquote><p style="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)">Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at</p><blockquote style="margin:0px 0px 16px;padding:0px 15px;color:rgb(119,119,119);border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);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)"><div style="margin-top:0px;margin-bottom:0px"><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote><p style="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)">or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:</p><blockquote style="margin:0px 0px 16px;padding:0px 15px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);background-color:rgb(255,255,255)"><p style="color:rgb(119,119,119);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;margin-top:0px;margin-bottom:16px">Proposal link:</p><blockquote style="margin:0px 0px 16px;padding:0px 15px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221)"><div style="margin-top:0px;margin-bottom:0px"><font color="#777777" face="Helvetica Neue, Helvetica, Segoe UI, Arial, freesans, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol" size="3"><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0024-optional-value-setter.md</a></font></div></blockquote><p style="color:rgb(119,119,119);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;margin-top:0px;margin-bottom:16px">Reply text</p><blockquote style="color:rgb(119,119,119);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;margin:0px;padding:0px 15px;border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221)"><div style="margin-top:0px;margin-bottom:0px">Other replies</div></blockquote></blockquote><h5 style="margin-top:1em;margin-bottom:16px;line-height:1.4;font-size:1em;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)"><a href="https://github.com/apple/swift-evolution#what-goes-into-a-review-1" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none;display:inline-block;padding-right:2px;line-height:1.1" target="_blank"><u></u><u></u><u></u><u></u></a>What goes into a review?</h5><p style="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)">The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:</p><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';font-size:16px;background-color:rgb(255,255,255)"><li>What is your evaluation of the proposal?</li><li>Is the problem being addressed significant enough to warrant a change to Swift?</li><li>Does this proposal fit well with the feel and direction of Swift?</li><li>If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?</li><li>How much effort did you put into your review? A glance, a quick reading, or an in-depth study?</li></ul><p style="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)">More information about the Swift evolution process is available at</p><blockquote style="margin:0px 0px 16px;padding:0px 15px;color:rgb(119,119,119);border-left-width:4px;border-left-style:solid;border-left-color:rgb(221,221,221);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)"><div style="margin-top:0px;margin-bottom:0px"><a href="https://github.com/apple/swift-evolution/blob/master/process.md" style="background-color:transparent;color:rgb(64,120,192);text-decoration:none" target="_blank">https://github.com/apple/swift-evolution/blob/master/process.md</a></div></blockquote><p style="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)">Thank you,</p><p style="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)">Doug Gregor</p><p style="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)">Review Manager</p></div><br></div></div><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></div>
<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>
<br></blockquote></div><br></div>
</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>