[swift-evolution] Prohibit invisible characters in identifier names
João Pinheiro
joao at joaopinheiro.org
Mon Jun 20 12:51:55 CDT 2016
Recently there has been a screenshot going around Twitter about C++ allowing zero-width spaces in variable names. Swift also suffers from this problem which can be abused to create ambiguous, misleading, and potentially obfuscate nefarious code.
I would like to propose a change to prohibit the use of invisible characters in identifier names.
I'm including an example of problematic code at the bottom of this email.
Sincerely,
João Pinheiro
/* The output for this code is:
A
B
C
1
2
3
*/
func test() { print("A") }
func test() { print("B") }
func test() { print("C") }
let abc = 1
let abc = 2
let abc = 3
test()
test()
test()
print(abc)
print(abc)
print(abc)
More information about the swift-evolution
mailing list