|
Interesting. In the 70's & 80's, 8-bit microcomputers had a the same problem as old teletypes: you couldn't type in some ASCII characters even when the computer could display them. (And many couldn't.) At least some home-grown tiny-C compilers allowed a Pascal-like "BEGIN" and "END" substitute, which I'm sure would be an abomination to Kernighan. Even Pascal itself could have a problem: the very popular TRS-80 Tiny Pascal used ( and ) instead of [ ] for arrays because neither brackets nor braces could be typed. To summarize from the article for { and }: Modern digraphs: <% , %>. This is only one that looks symmetric
Less-modern trigraphs: ??< , ??>
Unix v4 (in the teletype driver): \( , \)
PDP-11 B: *( , *)
PDP-7 B: $( , $)
In other micro software (Advanced MuMath for the TRS-80), I have seen: << , >> for [ , ]
(< , >) for { , }
Back in the 80's, the joke among new learners of C and Unix is that the designers must have had a very bad keyboard where typing each character was painful, because every keyword or command was so short and cryptic. This article suggests a different reason: on their 36-bit Honeywell 6070, "four characters fit into a word", so there was incentive to fit in 1 machine word.It also explains why they used the obscure characters {,},|, and ~ while never using the FAR more common # and @. In the Teletype driver, "#" is clear previous char, and "@" is clear current line. So unavailable for C. I will still curse the C designers to my dying day for picking * as the prefix operator for dereference pointer, when the more logical @ character was SITTING RIGHT THERE! On every keyboard! So now every newbie to C has to stop thinking "multiplication" when they see *. |
And what’s worse, many other languages copied this decision without understanding why it was made and why it’s completely nonsensical for modern languages.