• Riskable@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    5 days ago

    I thought China wanted more people who could read and write code?

    Nobody codes in Mandarin! No, not even Chinese people.

    They code in English and for a reason! It’s not a great or reassuring reason, but it’s a logical one: English doesn’t have any accent marks and a simple, 26-character alphabet. This means the meaning of code can be understood by a compiler or interpreter without having to deal with encodings or enormous lookup tables to determine if a character is valid for say, an assignment (e.g. foo = 1).

    I’ve met developers that tried coding in their native languages using Python, which is one of the few languages that actually supports using non-latin Unicode characters and even right-to-left writing. They all say the same thing: It sucks and it’s not worth the trouble.

    • BillyNaCl@lemmy.zip
      link
      fedilink
      arrow-up
      0
      ·
      3 days ago

      Obviously, you don’t understand programming. Programming does not have a strict English proficiency requirement. What is used in programming are identifiers; they merely distinguish variables and have no strict requirement for meaning. You can absolutely use pinyin or arbitrary strings as identifiers. The English level required for programming is only enough to understand reserved words—they’re just basic words.

      • Riskable@programming.dev
        link
        fedilink
        English
        arrow-up
        0
        ·
        3 days ago

        Have you ever actually tried it? Simple example: Try using an emoji for an assignment: ⭐=foo or foo=⭐

        It doesn’t work? Why? Because emojis aren’t valid for assignments. Why? Because Python follows Unicode Standard Annex #31 (UAX #31). Since emoji are classified as symbols, you can’t use them for assignments.

        Who cares? We’re taking Mandarin, right? Except there’s a practical problem: The most common input method for typing Mandarin (and other languages with bazillions of characters) outputs full-width characters (e.g. = full width equal sign) and this screws everything up. It does this for equals, parentheses, commas, and a few other symbols.

        My friend said that was the most annoying thing: Having to constantly switch back and forth.

        However, many characters that are used as normal words also don’t work for assignments. For example, Chinese numerals: 一, 二, 三 (the English equivalent of, one, two, three)

        Then there’s a practical problem: It looks wacky AF, making the code harder to read:

        if 用户.is_active():
            return 获取数据()
        

        The input method editor problem is the biggest one because it really slows you down. Having to switch in and out of it constantly also creates huge friction when coding.

        I just asked him and he just gave me something I didn’t even think about: Apparently git diffs (on the command line) don’t display Mandarin characters properly! That right there would make programming in Mandarin a no-go situation without a special git tool.

        Apparently, if you want to be able to deploy your code at all you have to know English. Or at least, Linux English (e.g. ls and similar programs haha).