I keep seeing some oddly varied and contradictory terms used to describe paired delimiter characters used in programming. Specifically, I see a lot of people using incorrect terms to refer to braces, brackets, and parentheses.
Sometimes, I hear people refer to “square brackets” and “curly braces”, which is fine, if a bit clumsy and redundant. At least they’re applying the correct terms to the correct delimiters. What really gets my goat, though, is when someone uses one term for everything — like “round brackets”, “square brackets”, and “curly brackets”. Once or twice, I’ve even seen people obstinately arrange to use the wrong terms for everything, all at once. An example that leaps to mind is a paragraph I came across one day on the Internet where someone referred to round brackets, curly brackets, and square braces. Como se huh? WTF, mate?
I say again, Whiskey Tango Foxtrot, over.
For those few of you programmatically inclined netizens who actually read my words here from time to time, here’s a quick and handy guide:
Parentheses are those curved things above the 9 and 0 keys on an American English qwerty keyboard layout. This is an open parenthesis: (
This is a closing parenthesis: )
Those are not frowny and smiley faces.
Brackets are those things made up of straight lines and corners that, on American English qwerty keyboards, are the next two keys to the right of the P key. This is an open bracket: [
This is a closing bracket: ]
They are not frowny and smiley robot faces.
Braces are the curly and pointy things that you reach by using the Shift key with the bracket keys on American English qwerty keyboards. This is an open brace: {
This is a closing brace: }
I don’t even want to know what you emoticon worshippers think those might be.
In Perl (for example), braces are used to enclose blocks of code and define lexical scope as well as to identify hash elements, brackets are generally used to define array elements and regex character classes, and parentheses are mostly used for expression grouping and (when you feel like it) enclosing the arguments of functions and certain function-like operators. Try to avoid getting them mixed up. Doing so can ruin an otherwise perfectly good program — and every time you misidentify them in conversation with other programmers, you increase the likelihood that someone else will screw up a perfectly good program.
Think of the children.
(This is cross-posted to Syndicated Oracular Babblings, or whatever else I’m calling it this week.)