3 ms·
and why not something more reasonable, like [], which doesn't require the shift key at least on US keyboards The OP is assuming the current US keyboard layout.
by jgrahamc 14y ago
and why not something more reasonable, like [], which doesn't require the shift key at least on US keyboards
The OP is assuming the current US keyboard layout. C was developed on the PDP-11 which would likely have used a DECwriter II for the keyboard/output.
On that keyboard [ ] are on the same key (non-shift is [, shift is ]). Thus [ ] were not 'easier' on it. Similarly, { } were on the same key with non-shift being { and shift being }.
C's predecessor BCPL used { } although it was developed on a machine without a keyboard and so typing those characters was just as easy as any other character. The developer might have had access to an IBM card punch with a keyboard but the keyboards on those were odd (IBM layout) with no [] or {} and $( was used in place of {.
- limmeau 14y agoOn German (and I think also Dutch) keyboards, {} are on AltGr-7 and 0, which is a pain to type (and the reason why I switch every computer to US keyboard). I wonder if that's why Python uses indentation and not braces for blocks...
- Tripfag 14y agoFlemish (Belgian Dutch) keyboards have them at AltGr9 and AltGr0. Works just fine, if you ask me.
- AlexanderDhoore 14y agoI'm also a Fleming and I HATE our keyboard. For example languages with $ signs for variables are horrible with it. $ needs AltGr and is all the way to the right. Thus requiring you to leave the home row completely. (Not even getting into how moronic the placements of (){}[] are.) Switched to QWERTY, not looking back.
- Tripfag 14y agoAh, nog ne Howest-er :p
- sjmulder 14y agoDutch people use US International layout keyboards almost exclusively (@ above 2). The Dutch layout (# above 2) is very very rare.
- walshemj 14y agoOut of interest how do dutch keyboards handle the IJ
- Someone 14y agoTypically: not. Historically, I don't think there were character sets that had it as a character. Unicode nowadays has it, but discourages its use. http://www.unicode.org/versions/Unicode6.1.0/ch07.pdf http://www.unicode.org/versions/Unicode6.1.0/ch07.pdf: "Another pair of characters, U+0133 latin small ligature ij and its uppercase version, was provided to support the digraph “ij” in Dutch, often termed a “ligature” in discussions of Dutch orthography. When adding intercharacter spacing for line justification, the “ij” is kept as a unit, and the space between the i and j does not increase. In titlecasing, both the i and the j are uppercased, as in the word “IJsselmeer.” Using a single code point might sim- plify software support for such features; however, because a vast amount of Dutch data is encoded without this digraph character, under most circumstances one will encounter an <i, j> sequence." But don't take my word for it; I used Google to see what a Dutch keyboard layout is supposed to look like because I don't think I have ever seen one in real life. There were typewriters with a ij ligature. That makes sense because that is about the worst kerning pair you can get in a monospaced font (but as a monospaced ligature, it is fairly tight with those large vertical stretches both at the left and at the right)
- Turing_Machine 14y ago"$( was used in place of {." That was very common. The C compilers for the Atari 8 bit computers (which used the ASCII values for { and } for graphics characters) did this too.
- mirkules 14y agoMy preference on an American keyboard is still curly braces, probably because of my typing style. In order to type { }, I hit the shift key with my right pinkie finger, which shifts my entire hand over and allows me to hit the brackets with precision with my middle or ring finger. When I type [ ], I use my middle and ring fingers but without anchoring my hand to the right shift key, and I often hit the wrong character. This is why I always found it awkward to program in Objective-C due to their extensive use of square brackets, whereas Java or PHP (or other C-like languages) come a lot more naturally (curly braces are more often used than square ones).
- groovy2shoes 14y agoAs far as I can tell, after having read Martin Richards's BCPL book and the BCPL reference manual, BCPL allowed only $( $) as section brackets. Looking at the current BCPL compiler code, it seems that it does now allow { } for section brackets, but the comments in the compiler suggest that it wasn't added until 1995. BCPL's section brackets were neat in that you could add a label to them and they would be parsed much like HTML tags. I think it's likely that B introduced the curly brackets in lieu of BCPL-style section brackets and omitted tagged brackets altogether, then B begat C, etc.