3 ms·
At first glance, I'd consider it a (security) bug in Perl 6 that it permits tokens containing invisible characters, let alone consisting solely of invisible cha
by geofft 11y ago
At first glance, I'd consider it a (security) bug in Perl 6 that it permits tokens containing invisible characters, let alone consisting solely of invisible characters. Are there any other languages with this behavior?
As a random example:
titan:~ geofft$ python3 -c "$(printf "\u2063") = 1"
File "<string>", line 1
= 1
^
SyntaxError: invalid character in identifier
If you change it to e.g. 00e9 ("é"), Python 3 permits the character, so it's not just a lower-ASCII thing.
- kbenson 11y agoWhat about carriage return. newline,form feed, etc? Those are invisible character, and those are just plain ASCII.
- chias 11y agoThose aren't invisible, merely transparent: they take up space, and alter the location of the cursor when inserted. Invisible characters don't.
- logfromblammo 11y agoAlso, some text-displaying programs will insert glyphs for them, to make them visible, which would make them somewhat more detectable. And the BEL character, while non-spacing and invisible, is sometimes audible.
- geofft 11y agoThose aren't valid tokens. "<newline> = 10" won't assign to a variable named <newline>. If the language wants to parse non-ASCII invisible characters as whitespace, or permit them inside comments or strings, that's fine.
- labster 11y agohttps://rt.perl.org/Public/Bug/Display.html?id=128159 https://rt.perl.org/Public/Bug/Display.html?id=128159 was filed by the author of this piece. The take-home to me is that supporting Unicode to a great depth in a language is really hard.
- ugexe 11y ago"invisible" is entirely dependent on your text editor
- xyience 11y agoMy company's large Java codebase has hundreds of zero-width spaces in the middle of method names. It's sad.
- yokohummer7 11y agoWhat's the reason? Were the method names needed to be aligned somehow?