<div dir="ltr"><div>possibly off-topic but what i would really find useful is some way of expressing guard/if assignment instead of initialization so that <br><br>        let geomSource:UnsafeMutableBufferPointer&lt;CChar&gt;?<br>        if let geometryFile:String = geometryFile<br>        {<br>            guard let _geomSource:UnsafeMutableBufferPointer&lt;CChar&gt; =<br>                Shader.openTextFile(Shader.posixPath(geometryFile))<br>            else<br>            {<br>                return nil<br>            }<br><br>            geomSource = _geomSource<br>        }<br><br></div>could be rewritten as <br><br>        let geomSource:UnsafeMutableBufferPointer&lt;CChar&gt;?<br>        if let geometryFile:String = geometryFile<br>        {<br>            guard geomSource:UnsafeMutableBufferPointer&lt;CChar&gt; =<br>                Shader.openTextFile(Shader.posixPath(geometryFile))<br>            else<br>            {<br>                return nil<br>            }<br>        }<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Dec 21, 2017 at 1:00 PM, Stephen Celis 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"><div style="word-wrap:break-word;line-break:after-white-space">Ah, sorry, I misread! For readability I think I&#39;d still favor something like:<div><br><div>    if let b = b {</div><div>      dict[a] = b</div><div>    }</div><div><br></div><div>And I think some the arguments made in #0024 may still apply here, though feel free to discuss!</div><div><br></div><div>Stephen<br><div><br><div><div><blockquote type="cite"><div><div class="h5"><div>On Dec 21, 2017, at 1:37 PM, Benoit Pereira da silva &lt;<a href="mailto:bpds@me.com" target="_blank">bpds@me.com</a>&gt; wrote:</div><br class="m_-1997168762520199439Apple-interchange-newline"></div></div><div><div><div class="h5"><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;float:none;display:inline!important">Stephen,</span><div 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"><br></div><div 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">You are right the proposal #0024 is very close.</div><div 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">But in fact the logic is inverted.  </div><div 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"><br></div><div 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">When using «=? » the right item is optional.</div><div 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">a =? b assigns « b »  to « a »  only if « b »  is defined.</div><div 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">So if an optional is defined =? will not erase its value.</div><div 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"><br></div><div 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">But my real questions was…</div><div 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">Do you have such operators that you really use very often?</div><div 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">Should we incorporate bunches of new operators / micro-syntactic sugar?</div><div 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">Is swift evolution the good place to discuss such question?</div><div 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"><br></div><div 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">I don’t want to pollute your mail boxes.</div><div 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"><br></div><div 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">Best regards,</div><div 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"><br></div><div 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">B</div></div></div><div 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"><div><div class="h5"><div><br><blockquote type="cite"><div>Le 21 déc. 2017 à 19:12, Stephen Celis &lt;<a href="mailto:stephen.celis@gmail.com" target="_blank">stephen.celis@gmail.com</a>&gt; a écrit :</div><br class="m_-1997168762520199439Apple-interchange-newline"><div><div style="word-wrap:break-word;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" target="_blank">https://github.com/<wbr>apple/swift-evolution/blob/<wbr>60a8980a66a0a1341871ec323797c5<wbr>547d0e0925/proposals/0024-<wbr>optional-value-setter.md</a><div><br></div><div>It was ultimately rejected: <a href="https://lists.swift.org/pipermail/swift-evolution-announce/2016-February/000043.html" target="_blank">https://lists.swift.<wbr>org/pipermail/swift-evolution-<wbr>announce/2016-February/000043.<wbr>html</a></div><div><br></div><div>Stephen<br><div><br><blockquote type="cite"><div>On Dec 21, 2017, at 11:44 AM, Benoit Pereira da silva via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt; wrote:</div><br class="m_-1997168762520199439Apple-interchange-newline"><div><div style="word-wrap:break-word;line-break:after-white-space"><div>Dear all,</div><div><br></div><div>That’s not ambitious but i think worth be explored.</div><div><br></div><div>What do you think for example of this Infix operator?</div><div>« =? »  allows to express optional assignments  in a very concise way.</div><div><br></div><div><br></div><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)">// 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)">//  `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)"><span style="color:rgb(198,101,118)">infix</span><span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(198,101,118)">operator</span><span class="m_-1997168762520199439Apple-converted-space"> </span>=?: AssignmentPrecedence</div><div style="margin:0px;font-stretch:normal;line-height:normal;background-color:rgb(0,58,93);min-height:14px"><br></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)"><span style="color:rgb(198,101,118)">public</span><span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(198,101,118)">func</span><span class="m_-1997168762520199439Apple-converted-space"> </span>=?&lt;T&gt; ( left:<span style="color:rgb(198,101,118)">inout</span><span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(63,167,173)">T</span>?, right:<span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(63,167,173)">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)">    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)">}</div><div style="margin:0px;font-stretch:normal;line-height:normal;background-color:rgb(0,58,93);min-height:14px"><br></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)"><span style="color:rgb(198,101,118)">public</span><span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(198,101,118)">func</span><span class="m_-1997168762520199439Apple-converted-space"> </span>=?&lt;T&gt; ( left:<span style="color:rgb(198,101,118)">inout</span><span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(63,167,173)">T</span>, right:<span class="m_-1997168762520199439Apple-converted-space"> </span><span style="color:rgb(63,167,173)">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)">    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)">}</div></div><div><br></div><div><br></div><div>Do you have such operators that you really use very often?</div><div><br></div></div></div></blockquote></div></div></div></div></blockquote></div><br></div></div><div><div><div class="h5"><div style="font-variant-ligatures: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;font-size:14px"><div><div style="word-wrap:break-word;line-break:after-white-space"><div style="word-wrap:break-word;line-break:after-white-space"><div style="word-wrap:break-word;line-break:after-white-space"><div style="word-wrap:break-word;line-break:after-white-space"><span style="font-size:12px;line-height:normal"><font face="HelveticaNeue-Light"><div style="word-wrap:break-word;line-break:after-white-space"><div style="margin:0px;line-height:normal"><div style="margin:0px;line-height:normal"><b>Benoit Pereira da Silva</b></div><div style="margin:0px;line-height:normal">Ultra Mobile Developer &amp; Movement Activist</div><div style="margin:0px;line-height:normal">Développeur Ultra Mobile &amp; Militant du mouvement</div><div style="margin:0px;line-height:normal"><a href="https://pereira-da-silva.com/" target="_blank">https://pereira-da-silva.com</a></div><div style="margin:0px;line-height:normal"><span style="line-height:normal"></span></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><span></span></div></font></span></div></div></div></div></div></div></div></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures: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"><br class="m_-1997168762520199439Apple-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;font-variant-ligatures: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;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal"><span><span><span><span><span><span><span><span><span id="m_-1997168762520199439cid:E3AF4CA8-D774-47D1-AF27-2B086409AEED@home">&lt;bannerp.jpg&gt;</span></span><span class=""><div 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;font-variant-ligatures: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-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"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures: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"><span><span><br class="m_-1997168762520199439Apple-interchange-newline"><br class="m_-1997168762520199439Apple-interchange-newline"><br></span></span></span></span></div><div 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;font-variant-ligatures: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-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"><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant-ligatures: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"><span><span><div style="font-family:HelveticaNeue-Light"><div><span style="background-color:rgb(255,255,255)">✄ ----------------------------<wbr>----</span><br><font size="1">This e-mail is confidential. Distribution, copy, publication or use of this information for any purpose is prohibited without agreement of the sender.<br>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&#39;expéditeur.</font></div></div></span></span></span></span></div></span></span></span></span></span></span></span></span></span></span></div></div></div></blockquote></div><br></div></div></div></div></div><br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div>