<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Something like that would be good.<div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 2016-01-28, at 12:50:50, Paul Ossenbruggen &lt;<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Maybe something like this?<div class=""><br class=""></div><div class=""><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> n : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span>? = <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class=""><br class=""></span></div></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> r = <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">n</span>? + <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class=""><br class=""></span></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class=""><br class=""></span></div></div><div class=""><blockquote type="cite" class=""><div class="">On Jan 27, 2016, at 9:46 PM, Thorsten Seitz &lt;<a href="mailto:tseitz42@icloud.com" class="">tseitz42@icloud.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class=""></div><div class="">Too much hidden magic IMO. This would mean loosing the benefits of optionals, i.e. making explicit where optional cases occur and that handling the missing case has to be considered.&nbsp;</div><div class=""><br class=""></div><div class="">-Thorsten&nbsp;</div><div class=""><br class="">Am 28.01.2016 um 06:30 schrieb Craig Cruden via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class="">Yes<br class=""><div class=""><blockquote type="cite" class=""><div class="">On 2016-01-28, at 12:28:40, Paul Ossenbruggen &lt;<a href="mailto:possen@gmail.com" class="">possen@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Trying to see if I got this. So the type of r would be Int? at the end of this? And if n were nil then r would be nil? Otherwise it r is 10?<div class=""><br class=""></div><div class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 27, 2016, at 9:19 PM, Craig Cruden via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Swift currently encourages a lot of conditional code - especially when it comes to optionals. &nbsp;In most cases when you are computing etc. on an Optional you would expect that you would want an optional result and things to be able to use optionals. &nbsp;<div class=""><br class=""></div><div class="">In another language I generally just `map` one optional to another - which may not be the most readable code to some not use to optionals. &nbsp;</div><div class=""><br class=""></div><div class="">I was wondering if maybe an expression is not available that it would rewrite the syntax to map from one to another value. &nbsp;</div><div class=""><br class=""></div><div class="">So things like:</div><div class=""><br class=""></div><div class="">let n : Int? = 5</div><div class=""><br class=""></div><div class="">let r = n + 5</div><div class=""><br class=""></div><div class="">would actually compile as&nbsp;</div><div class=""><br class=""></div><div class="">let r = n.map&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">{$0 + </span><span style="font-family: Menlo; font-size: 11px; color: rgb(39, 42, 216);" class="">5</span><span style="font-family: Menlo; font-size: 11px;" class="">}</span></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></div></div></div></blockquote></div><br class=""></div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></div></body></html>