[swift-evolution] Prohibit invisible characters in identifier names

Josh Wisenbaker macshome at mac.com
Thu Jun 23 16:59:28 CDT 2016


> On Jun 23, 2016, at 4:45 PM, Xiaodi Wu via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Let me correct myself: what I think Josh's example is should be corrected whether we prohibit or ignore. However, since no one can see the invisible characters he used, I can't say for sure.
> 
> If he found a clever way to reorder or change spacing between letters (e.g. superimpose two characters so that "var11" looks like "var1"), then the problem can only be fixed by prohibition.

I asked my colleague who played the prank on me and got the details:

"Lines 4 and 5 declare variables with embedded Unicode Zero Width Spaces (U+200B) in their names. Line 4 is actually  “var\U+200B1”, not “var1”. Isn’t it nice of Swift to be this flexible 😊”

Josh


Josh Wisenbaker
macshome at mac.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/ae2a5e9b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4103 bytes
Desc: not available
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/ae2a5e9b/attachment.p7s>


More information about the swift-evolution mailing list