
On Wed, Jan 19, 2022 at 11:10 AM Steven D'Aprano <steve@pearwood.info> wrote:
On Wed, Jan 19, 2022 at 10:12:23AM +1100, Chris Angelico wrote:
Not sure about Python, but C and C++ have digraphs and trigraphs as alternatives for certain symbols, specifically because some OS/keyboard/language combinations may not be able to easily type the originals.
I believe that those C digraphs date back to days when ASCII was not a guaranteed lowest common denominator, and there were computers that did not support characters such as braces {}. And then C++ just inherited them from C.
C++ added some of its own, but I believe the justification was the same. It's not just about ASCII though; it's about keyboards and input methods, and I'm unsure when that stopped being a concern. Maybe it still hasn't, in some places in the world. Worth noting: In many places in the world, ASCII Latin letters are not the ones used for normal text. What's the normal way to write language keywords and builtins? Do people switch keyboard layouts? Is there a standard way to quickly enter a Python keyword and have it transliterated? Would love to hear from someone who uses Python in Russian, Greek, Korean, Arabic, or any other non-Latin language.
Pascal had the same thing: comments were either {comment} or (*comment*) specifically because in the 1970s there were lots of computers and OSes that did not support braces. It wasn't until the early 80s that the ASCII character set became more or less universally supported in the English-speaking world.
Huh. I remember the (*comment*) style being the dominant one. Didn't know it was due to charset limitations. ChrisA