5 ms·
That example with the Chinese characters brings up a point that seems to have gotten lost or actively suppressed, likely by those with other motives: what may l
by userbinator 3y ago
That example with the Chinese characters brings up a point that seems to have gotten lost or actively suppressed, likely by those with other motives: what may look "unreadable" to you may in fact be something that is perfectly normal to billions of others. Yet why are people constantly told to emphasise "readability" in the code they write, which really refers to a lowest-common-denominator dumbing down approach? Shouldn't the onus be on the reader to educate oneself sufficiently in the language to understand code that one thinks is "unreadable"? Moreover, unlike natural languages, programming languages are defined exactly and systematically, so there is no ambiguity whether a piece of code is valid or what it does.
What is "unreadable" to some could be perfectly readable to others; and what is readable to some could still be readable but unnecessarily verbose and tedious to read to others. We shouldn't let how we write code be dictated by those who barely know the language and want to drag us down to their level.
- lamontcg 3y agoWhich is why I think languages need UTF-8 identifiers and arbitrary UTF-8 operators. Most people working on webdev in the USA should never touch them and should feel free to ban them in their linters. But people who speak and write foreign languages with other alphabets and domain experts and people who just want to use π or µ or ∆v or whatever because they feel it makes their code clearer should be able to. Mathematicians who have PhDs should be able to write arbitrarily complicated heiroglyphical operators that I probably won't choose to understand in this lifetime. And that's okay, I don't need a language that attempts to guarantee that I can always read it, that is probably literally impossible and just constrains it unnecessarily.
- schoen 3y agoCoq has an interesting compromise, where the actual code passed to the compiler is in ASCII, but one can define sequences which have alternative renderings (usually to attempt to visually match existing math notation). For example, one could write Theorem demo: forall (x: nat), (exists y, x = S y) -> x <> 0. In many editors, this will get rendered as Theorem demo: ∀ (x: ℕ), (∃ y, x = S y) → x ≠ 0. This looks a lot nicer for mathematicians. (S here is Peano successor.) One minor nuisance is that, without an additional plugin, you can't actually write source code literally using the Unicode symbols (they're normally display-only, not part of a source file). The plugin to allow one to type them explicitly (with a Unicode-aware input method) does exist, but would make one's source code not portable for other users. Also, this is really specifically for math, not internationalization, and doesn't provide a helpful model for people wanting to type identifiers in non-ASCII-supported scripts.
- silvestrov 3y agoOne case where UTF-8 identifiers are needed is (Danish) tax calculation and legal concepts which do not have an equivalent version in English. I.e. you have a name/concept which cannot be translated into English. If you enforce "all names must be English" then you end up with a made up word. If you are an English only speaker, try imagine that you were not allowed to use "w" in any variable name as it would be considered a "too weird" letter.