<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">To answer your meta question, no, we don’t want to add lots of operators. We are willing to add them if they are very strongly motivated, but prefer not to if there are other ways to solve the problem.<div><br></div><div>In this case it sounds like:</div><div><br></div><div> x = optionalValue ?? x</div><div><br></div><div>Is a reasonable substitute.<br><br><div id="AppleMailSignature"><div>-Chris</div></div><div><br>On Dec 21, 2017, at 10:38 AM, Benoit Pereira da silva via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br><br></div><blockquote type="cite"><div><meta http-equiv="Content-Type" content="text/html; charset=utf-8">Stephen,<div class=""><br class=""></div><div class="">You are right the proposal #0024 is very close.</div><div class="">But in fact the logic is inverted. </div><div class=""><br class=""></div><div class="">When using «=? » the right item is optional.</div><div class="">a =? b assigns « b » to « a » only if « b » is defined.</div><div class="">So if an optional is defined =? will not erase its value.</div><div class=""><br class=""></div><div class="">But my real questions was…</div><div class="">Do you have such operators that you really use very often?</div><div class="">Should we incorporate bunches of new operators / micro-syntactic sugar?</div><div class="">Is swift evolution the good place to discuss such question?</div><div class=""><br class=""></div><div class="">I don’t want to pollute your mail boxes.</div><div class=""><br class=""></div><div class="">Best regards,</div><div class=""><br class=""></div><div class="">B</div><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">Le 21 déc. 2017 à 19:12, Stephen Celis <<a href="mailto:stephen.celis@gmail.com" class="">stephen.celis@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Such an operator was proposed here: <a href="https://github.com/apple/swift-evolution/blob/60a8980a66a0a1341871ec323797c5547d0e0925/proposals/0024-optional-value-setter.md" class="">https://github.com/apple/swift-evolution/blob/60a8980a66a0a1341871ec323797c5547d0e0925/proposals/0024-optional-value-setter.md</a><div class=""><br class=""></div><div class="">It was ultimately rejected: <a href="https://lists.swift.org/pipermail/swift-evolution-announce/2016-February/000043.html" class="">https://lists.swift.org/pipermail/swift-evolution-announce/2016-February/000043.html</a></div><div class=""><br class=""></div><div class="">Stephen<br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">On Dec 21, 2017, at 11:44 AM, Benoit Pereira da silva via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class="">Dear all,</div><div class=""><br class=""></div><div class="">That’s not ambitious but i think worth be explored.</div><div class=""><br class=""></div><div class="">What do you think for example of this Infix operator?</div><div class="">« =? » allows to express optional assignments in a very concise way.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(125, 126, 126); background-color: rgb(0, 58, 93);" class="">// The `=? operator allows simplify optional assignements :</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(125, 126, 126); background-color: rgb(0, 58, 93);" class="">// `a = b ?? a` can be written : `a =? b`</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class=""><span style="color: #c66576" class="">infix</span> <span style="color: #c66576" class="">operator</span> =?: AssignmentPrecedence</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(0, 58, 93); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class=""><span style="color: #c66576" class="">public</span> <span style="color: #c66576" class="">func</span> =?<T> ( left:<span style="color: #c66576" class="">inout</span> <span style="color: #3fa7ad" class="">T</span>?, right: <span style="color: #3fa7ad" class="">T</span>? ){</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class=""> left = right ?? left</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class="">}</div><div style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(0, 58, 93); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class=""><span style="color: #c66576" class="">public</span> <span style="color: #c66576" class="">func</span> =?<T> ( left:<span style="color: #c66576" class="">inout</span> <span style="color: #3fa7ad" class="">T</span>, right: <span style="color: #3fa7ad" class="">T</span>? ){</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class=""> left = right ?? left</div><div style="margin: 0px; font-stretch: normal; font-size: 13.5px; line-height: normal; font-family: Menlo; color: rgb(189, 178, 160); background-color: rgb(0, 58, 93);" class="">}</div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">Do you have such operators that you really use very often?</div><div class=""><br class=""></div></div></div></blockquote></div></div></div></div></blockquote></div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 14px;" class=""><div apple-content-edited="true" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span style="font-size: 12px; line-height: normal; orphans: 2; widows: 2;" class=""><font face="HelveticaNeue-Light" class=""><div style="orphans: auto; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal;" class=""><b class="">Benoit Pereira da Silva</b></div><div style="margin: 0px; line-height: normal;" class="">Ultra Mobile Developer & Movement Activist</div><div style="margin: 0px; line-height: normal;" class="">Développeur Ultra Mobile & Militant du mouvement</div><div style="margin: 0px; line-height: normal;" class=""><a href="https://pereira-da-silva.com/" class="">https://pereira-da-silva.com</a></div><div style="margin: 0px; line-height: normal;" class=""><span style="line-height: normal;" class=""></span></div></div></div><div style="orphans: auto; widows: auto; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><span class=""></span></div></font></span></div></div></div></div></div></div><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class="Apple-interchange-newline" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><span><span><span><span><span><span><span><span><img apple-inline="yes" id="AD39175E-6862-40C2-9784-4786773031E6" src="cid:E3AF4CA8-D774-47D1-AF27-2B086409AEED@home"></span><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span><span><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br class=""></span></span></span></span></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;" class=""><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-ligatures: normal; font-variant-position: normal; font-variant-caps: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span><span><div style="font-family: HelveticaNeue-Light; orphans: 2; widows: 2;" class=""><div class=""><span style="orphans: auto; widows: auto; background-color: rgb(255, 255, 255);" class="">✄ --------------------------------</span><br style="orphans: auto; widows: auto;" class=""><font size="1" style="orphans: auto; widows: auto;" class="">This e-mail is confidential. Distribution, copy, publication or use of this information for any purpose is prohibited without agreement of the sender.<br class="">Ce message est confidentiel. Toute distribution, copie, publication ou usage des informations contenues dans ce message sont interdits sans agrément préalable de l'expéditeur.</font><br style="orphans: auto; widows: auto;" class=""></div></div></span></span></span></span></div><br class="Apple-interchange-newline" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;"><br class="Apple-interchange-newline" style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-variant-ligatures: normal; font-variant-position: normal; font-variant-numeric: normal; font-variant-alternates: normal; font-variant-east-asian: normal;">
</span></span></span></span></span></span></span></span></span></div>
<br class=""></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></div></body></html>