<html><head><meta http-equiv="Content-Type" content="text/html charset=gb2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Craig,<br class=""><div><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">From the first email on that subject:</div><div class=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class=""></pre><blockquote type="cite" class=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">So things like:
let n : Int? = 5
let r = n + 5
would actually compile as
let r = n.map {$0 + 5}</pre></blockquote><div class=""><br class=""></div></div><div class="">Yes, this is my expect.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class="">I’ll read through that subject later.</div><div class=""><br class=""></div><br class=""><div class=""><blockquote type="cite" class=""><div class="">在 2016年2月16日,11:44,Craig Cruden <<a href="mailto:ccruden@novafore.com" class="">ccruden@novafore.com</a>> 写道:</div><br class="Apple-interchange-newline"><div class=""><div class="">There is a thread on this (if I understand correctly):<br class=""><br class=""><span class="Apple-tab-span" style="white-space:pre">        </span>Subject : Brainstorming: Optional sugar inferred map<br class=""><br class=""><blockquote type="cite" class="">On 2016-02-16, at 10:40:48, Cao Jiannan via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><br class="">Hi all,<br class=""><br class="">I want to discuss some problems on using operator on optional values.<br class=""><br class="">Here is my code:<br class=""><blockquote type="cite" class=""><br class="">let value: Bool? = false<br class=""><br class="">let result = !value // the variable ‘result' is expected Optional<Bool> type,<br class=""> // if value is nil, then the result should be nil<br class=""> // otherwise it returns the result of NOT operator.<br class=""></blockquote><br class="">This cannot work with Swift 2.1.<br class=""><br class=""><br class=""><blockquote type="cite" class="">let value: Int? = 0<br class=""><br class="">let result = value + 1 // the variable ‘result' is expected Optional<Int> type<br class=""> // if value is nil, then the result should be nil<br class=""> // otherwise it returns the result of NOT operator.<br class=""></blockquote><br class="">This is also cannot work with Swift 2.1.<br class=""><br class="">If the basic value operator can work with optional types, it will save multiple lines in out code.<br class=""><br class="">Thanks!<br class=""><br class="">Jiannan, Cao<br class=""><br class=""><br class=""><br class=""><br class=""><br class=""><br class="">_______________________________________________<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=""></blockquote><br class=""></div></div></blockquote></div><br class=""></div></div><br class=""></body></html>