<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Ah, sorry, I misread! For readability I think I'd still favor something like:<div class=""><br class=""><div class=""> if let b = b {</div><div class=""> dict[a] = b</div><div class=""> }</div><div class=""><br class=""></div><div class="">And I think some the arguments made in #0024 may still apply here, though feel free to discuss!</div><div class=""><br class=""></div><div class="">Stephen<br class=""><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Dec 21, 2017, at 1:37 PM, Benoit Pereira da silva <<a href="mailto:bpds@me.com" class="">bpds@me.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Stephen,</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">You are right the proposal #0024 is very close.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">But in fact the logic is inverted. </div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">When using «=? » the right item is optional.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">a =? b assigns « b » to « a » only if « b » is defined.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">So if an optional is defined =? will not erase its value.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">But my real questions was…</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Do you have such operators that you really use very often?</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Should we incorporate bunches of new operators / micro-syntactic sugar?</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Is swift evolution the good place to discuss such question?</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">I don’t want to pollute your mail boxes.</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Best regards,</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">B</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class=""><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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><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 class="" 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);">// The `=? operator allows simplify optional assignements :</div><div class="" 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);">// `a = b ?? a` can be written : `a =? b`</div><div class="" 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);"><span class="" style="color: rgb(198, 101, 118);">infix</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(198, 101, 118);">operator</span><span class="Apple-converted-space"> </span>=?: AssignmentPrecedence</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(0, 58, 93); min-height: 14px;"><br class=""></div><div class="" 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);"><span class="" style="color: rgb(198, 101, 118);">public</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(198, 101, 118);">func</span><span class="Apple-converted-space"> </span>=?<T> ( left:<span class="" style="color: rgb(198, 101, 118);">inout</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(63, 167, 173);">T</span>?, right:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(63, 167, 173);">T</span>? ){</div><div class="" 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);"> left = right ?? left</div><div class="" 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);">}</div><div class="" style="margin: 0px; font-stretch: normal; line-height: normal; background-color: rgb(0, 58, 93); min-height: 14px;"><br class=""></div><div class="" 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);"><span class="" style="color: rgb(198, 101, 118);">public</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(198, 101, 118);">func</span><span class="Apple-converted-space"> </span>=?<T> ( left:<span class="" style="color: rgb(198, 101, 118);">inout</span><span class="Apple-converted-space"> </span><span class="" style="color: rgb(63, 167, 173);">T</span>, right:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(63, 167, 173);">T</span>? ){</div><div class="" 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);"> left = right ?? left</div><div class="" 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);">}</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 class="" style="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-size: 14px;"><div apple-content-edited="true" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span class="" style="font-size: 12px; line-height: normal; orphans: 2; widows: 2;"><font face="HelveticaNeue-Light" class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="" style="margin: 0px; line-height: normal;"><div class="" style="margin: 0px; line-height: normal;"><b class="">Benoit Pereira da Silva</b></div><div class="" style="margin: 0px; line-height: normal;">Ultra Mobile Developer & Movement Activist</div><div class="" style="margin: 0px; line-height: normal;">Développeur Ultra Mobile & Militant du mouvement</div><div class="" style="margin: 0px; line-height: normal;"><a href="https://pereira-da-silva.com/" class="">https://pereira-da-silva.com</a></div><div class="" style="margin: 0px; line-height: normal;"><span class="" style="line-height: normal;"></span></div></div></div><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><span class=""></span></div></font></span></div></div></div></div></div></div><span style="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 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="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 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 class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span class=""><span id="cid:E3AF4CA8-D774-47D1-AF27-2B086409AEED@home"><bannerp.jpg></span></span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 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="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class=""><span class=""><br class="Apple-interchange-newline"><br class="Apple-interchange-newline"><br class=""></span></span></span></span></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; 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="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="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; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span class=""><span class=""><div class="" style="font-family: HelveticaNeue-Light; orphans: 2; widows: 2;"><div class=""><span class="" style="background-color: rgb(255, 255, 255);">✄ --------------------------------</span><br class=""><font size="1" 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></div></div></span></span></span></span></div></span></span></span></span></span></span></span></span></span></div></div></div></blockquote></div><br class=""></div></div></div></div></body></html>