News for hackers. Stuff that matters.
Re:Why do programming languages use curly braces? by jgrahamc on Tuesday February 26, 2013 @10:40AM (#5286189)
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 {.

Re:Why do programming languages use curly braces? by limmeau on Tuesday February 26, 2013 @10:50AM (#5286259)
On 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...
Re:Why do programming languages use curly braces? by sjmulder on Tuesday February 26, 2013 @11:19AM (#5286465)
Dutch people use US International layout keyboards almost exclusively (@ above 2). The Dutch layout (# above 2) is very very rare.
Re:Why do programming languages use curly braces? by walshemj on Tuesday February 26, 2013 @12:16PM (#5286895)
Out of interest how do dutch keyboards handle the IJ
Re:Why do programming languages use curly braces? by Someone on Tuesday February 26, 2013 @01:39PM (#5287463)
Typically: 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: "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)

Re:Why do programming languages use curly braces? by Tripfag on Tuesday February 26, 2013 @11:02AM (#5286332)
Flemish (Belgian Dutch) keyboards have them at AltGr9 and AltGr0. Works just fine, if you ask me.
Re:Why do programming languages use curly braces? by AlexanderDhoore on Tuesday February 26, 2013 @11:48AM (#5286687)
I'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.

Re:Why do programming languages use curly braces? by Tripfag on Tuesday February 26, 2013 @12:03PM (#5286805)
Ah, nog ne Howest-er :p
Re:Why do programming languages use curly braces? by groovy2shoes on Tuesday February 26, 2013 @12:37PM (#5287039)
As 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.
Re:Why do programming languages use curly braces? by mirkules on Tuesday February 26, 2013 @11:47AM (#5286683)
My 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).

Re:Why do programming languages use curly braces? by Turing_Machine on Tuesday February 26, 2013 @11:31AM (#5286565)
"$( 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.