<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">2016-11-02 13:14 GMT+09:00 Benjamin Spratling via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div>CGRect(origin:.zero, size:..</div><div><br></div><div>is pretty nice. Why do you want to get rid of it?</div></div></blockquote><div><br></div><div>No, I'm proposing to reject CGRect(origin:. zero, size:..)</div><div><br></div><div> <font face="monospace, monospace">'.' whitespace identifier</font></div><div><font face="monospace, monospace"><br></font></div>Reject whitespace in this.</div><div class="gmail_quote"><br></div><div class="gmail_quote"> <span style="font-family:monospace,monospace">'.' identifier</span></div><br>is OK.</div><div class="gmail_extra"><br><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><br></div><div><br></div><div>return values</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>.flatMap {</div></div></blockquote><div><br></div><div>is OK. but </div><div><br></div><div> return valus</div><div> .</div><div> flatMap {</div><div><br></div><div>should be rejected.</div><div> </div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">                </span>//code</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>} </div></div></blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>.filter {</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">                </span>//code</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>}</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>.sorted { /* code */ <span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span> }</div><div><span class="gmail-m_-3812367530394476926Apple-tab-span" style="white-space:pre-wrap">        </span>.first</div><div><br></div><div>is also pretty clean, considering.</div><div><br></div><br><div><blockquote type="cite"><div><div class="gmail-h5"><div>On Nov 1, 2016, at 11:06 PM, rintaro ishizaki via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:</div><br class="gmail-m_-3812367530394476926Apple-interchange-newline"></div></div><div><div><div class="gmail-h5"><div dir="ltr"><div>Hi all,</div><div><br></div><div>The compiler currently accepts these expressions:<br></div><div><font face="monospace, monospace"><br></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">x = expr . member</font></div><div><font face="monospace, monospace">x = </font><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace"> </font><span style="font-family:monospace,monospace">.</span></div><div><font face="monospace, monospace"> member</font></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace">x = expr</font></div><div><font face="monospace, monospace"> .</font></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace"> member</font></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><span style="font-family:monospace,monospace">x = .</span><br></div></blockquote><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="monospace, monospace"> implicitMember</font></div></blockquote><div><font face="monospace, monospace"><br></font></div>I propose to reject them because this could cause some unnecessary confusion.<div>(especially after <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0071-member-keywords.md" target="_blank">SE-0071</a>)<br><div>For instance:<div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div><font face="monospace, monospace">_ = foo(.</font></div></div></div><div><div><div><font face="monospace, monospace">func bar(x: Int) { ... }</font></div></div></div></blockquote><div><div><div><br></div><div>The current compiler parses this as:</div><div><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><div><font face="monospace, monospace"><font color="#999999">// call foo(_:_:)</font></font></div></div></div><div><div><font face="monospace, monospace">_ = foo(.func <font color="#999999">// </font></font><span style="color:rgb(153,153,153);font-family:monospace,monospace">implicit-member-expression</span></div><div><span style="color:rgb(153,153,153);font-family:monospace,monospace"> // missing ','</span></div></div><div><div><div><font face="monospace, monospace"> <font color="#999999">// call bar(x:_:) with </font></font><span style="color:rgb(153,153,153);font-family:monospace,monospace">argument 'Int' and trailing closure</span></div></div></div><div><div><div><font face="monospace, monospace"> bar(x<font>: Int</font>) { ... }</font></div></div></div><div><div><div><font color="#999999" style="font-family:monospace,monospace">// missing closing ')'</font></div></div></div></blockquote><div><div><div><br></div><div>Here's the summary of <i>current</i> behavior:<br></div></div><div><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><font face="monospace, monospace">// accept</font></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace">.member</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">// accept</font></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace"> .member</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">// accept</font></div></div><div><span style="font-family:monospace,monospace">expr</span><br></div><div><div><font face="monospace, monospace"> .member</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">// reject with fix-it to remove white spaces</font></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace">. member</font></div></div><div><div><div><font face="monospace, monospace"><br></font></div></div></div><div><div><div><font face="monospace, monospace">// </font><span style="font-family:monospace,monospace">two distinct statements</span></div></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace">. </font><span style="font-family:monospace,monospace">// reject as missing member name</span></div></div><div><div><div><font face="monospace, monospace"> member</font></div></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><font face="monospace, monospace">// accept</font></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace"> . member</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><div><font face="monospace, monospace">// accept</font></div></div></div><div><div><span style="font-family:monospace,monospace">expr</span><font face="monospace, monospace"> .</font></div></div><div><div><div><font face="monospace, monospace"> member</font></div></div></div></blockquote><div><div><br>I propose to change the last 2 examples:</div><div><span style="font-family:monospace,monospace"><br></span></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><span style="font-family:monospace,monospace">// reject with fix-it to remove white spaces</span></div></div><div><div><font face="monospace, monospace">some . member</font></div></div><div><div><font face="monospace, monospace"><br></font></div></div><div><div><span style="font-family:monospace,monospace">// two distinct statements </span></div></div><div><div><font face="monospace, monospace">some . // reject as missing member name</font></div></div><div><div><font face="monospace, monospace"> member</font></div></div></blockquote><div><div><br></div><div>I think, this is consistent behavior with '<font face="monospace, monospace">.</font>' at postfix position.</div><div><br></div><div>Specifically:</div><div><ul><li>If '<font face="monospace, monospace">.</font>' is at <i>prefix-operator</i> or <i>unspaced-binary-operator</i> position, accept.<br></li><li>If the next token after '<font face="monospace, monospace">.</font>' is at the same line, propose to fix-it.<br></li><li>Otherwise, reject it as missing member name.</li></ul></div><div>This affect following expressions and types in the grammer:</div><div><br></div><div>expressions:</div> self-method-expression<br> self-initializer-expression <br> superclass-method-expression<br> superclass-initializer-express<wbr>ion<br> implicit-member-expression<br> initializer-expression<br> explicit-member-expression<br> postfix-self-expression<br> explicit-member-expression<br> postfix-self-expression</div><div>types:<br><div> type-identifier<br></div></div> metatype-type<div><br></div><div>Of course this is a source breaking change, though.</div><div>Any thought?</div><div><br></div></div></div></div></div>
______________________________<wbr>_________________<br>swift-evolution mailing list<br><a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br></div></blockquote></div><br></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></div>