<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 14, 2015, at 8:15 PM, Jesse Rusak via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">I’m investigating this bug: <a href="https://bugs.swift.org/browse/SR-186" class="">https://bugs.swift.org/browse/SR-186</a></div><div class=""><br class=""></div><div class="">Which appears to be a result of the fact that the logic that determines if an operator is prefix/postfix/binary does not treat comments as whitespace. So, for example:</div><div class=""><br class=""></div><div class=""><font face="Andale Mono" class="">/* comment */!foo</font></div><div class=""><br class=""></div><div class="">does not lex as expected because the “!" thinks it has an something on both sides and so is treated as a binary operator. </div><div class=""><br class=""></div><div class="">Fixing this (by treating comments as whitespace here) will break existing code which relies on the current behavior, such as:</div><div class=""><br class=""></div><div class=""><font face="Andale Mono" class="">foo/* comment */!</font></div><div class=""><br class=""></div><div class="">which currently treats the “!” as a postfix operator but will change to binary. I expect these cases would be rare (maybe in some generated code?), but the results might be pretty confusing. </div><div class=""><br class=""></div><div class="">Any objections to fixing this or other thoughts? </div></div></div></blockquote><br class=""></div><div>There are two defensible models here:</div><div><br class=""></div><div>1) comments should be treated as whitespace.</div><div>2) comments should be treated as if they were not present.</div><div><br class=""></div><div>The later model seems more ideal to me (because you can put whitespace on either side of the comment after all), but I don’t have a strong opinion about that. What do others think?</div><div><br class=""></div><div>-Chris</div><br class=""></body></html>