by josteink · 5y ago · 0 comments
I literally have personal reasons for getting everyone, and I mean everyone, on the unicode bandwagon.
That said... Maybe it's because I'm a child of the late 70s and early 80s and learned to program on computers which simply didn't have non-ASCII characters at all...
But can't we all just sit down and admit that allowing non-ASCII characters in programming-language identifiers was a bad idea? Can't we in the next revision of EcmaScript (or Rust, or whatever) mandate ASCII-only identifiers when in strict mode or using modules or whatever? Having invisible characters represent executable code is not just a dumb a idea, it's so hazardous that you might call it borderline malicious.
There has to be some way to undo this damage, without breaking compatibility with the code which is already out there, right?
I disagree with the getting everyone on the Unicode bandwagon though, IMO Unicode has introduced a ton of problems exactly because it tries to be a ton of stuff at the same time. I don't know how exactly a better solution would be but i have a very hard time accepting that such a convoluted and error prone system is the best solution. IMO if decades later there are still issues with getting it right then there is something fundamentally wrong with the system itself and not with the applications and developers trying to work with it.
And even if the perfect solution existed right now, in a few decades it will be as filed with baggage as the current one.
Sometime one has to realize that hard problems are hard.
And trying to have a single thing solve everything doesn't help at all. When a problem is hard you try to break it into subproblems.
Unicode simply tries to do a lot of things at once.
The Unicode Consortium already maintains all of that data in the CLDR (Common Locale Data Registry).
[1] https://www.unicode.org/reports/tr24/tr24-32.html#Script_Ext...
This mostly comes up when implementing tax rules or government administrative divisions as some countries have names/concepts which have no good translation into English, so you are left with using the non-English name, which often contains non-ASCII characters.
The problem is not so much that humans can't see this but that they are not looking very hard to begin with (otherwise, they'd be using the appropriate tools) and that we should rely less on them actively looking. Blind trust that things will be fine is the root problem here.
And simply not allowing non-ASCII identifiers in the first place would be a move in that direction. Now you have one thing less to look for.
It's a bad idea only if all members in your team can easily produce and comprehend an ASCII-only code.
> Having invisible characters represent executable code is not just a dumb a idea, it's so hazardous that you might call it borderline malicious.
Not if those invisible characters do affect the rendering. Invisible formatting characters like ZWJ and ZWNJ are allowed because they are used in some scripts. The relevant Unicode specification [1] even provides a guideline to limit ZWJ and ZWNJ strictly to the context where they do affect the rendering.
That said, the Hangul filler and half-width Hangul filler were mistakes. They are purely legacy characters and never have been used in practice, so I encourage new languages to exclude them from the default (X)ID_Start/Continue set (Unicode can't do that because of the compatibility, maybe they can introduce another pair of properties without those characters).
[1] https://unicode.org/reports/tr31/#Layout_and_Format_Control_...
Which is exactly what I am suggesting by saying non-ASCII characters should be banned from being used as identifiers, not from being present in the code-file all together or in the form of strings, etc.
If the formatting of your output in your applications (as seen by the user) depends on the names you've declared your variables with, then you are doing something horribly wrong.
While you respond as if I want to banish anything non-ASCII from all parts of all code-files except from HTML-templates. That’s certainly not what I’m advocating.
The following is IMO perfectly fine:
var greeting = “Hello (cowboy emoji)”;
The following is IMO not: var (emoji) = “Let’s party!”; // note identifier contains non-ascii
Do you still disagree? If so, can you outline why?But yeah, it would break existing code, sorry.