27

I need to name a variable containing ()[]{}, what is the common name for all of them?

Two side questions:

  • parentheses is plural, or singular, or both?
  • is abbreviating it as parens understandable?
1

7 Answers 7

18

There isn't really an established generic for them; if I had to say something, I'd probably say enclosing glyphs. Trying to use "bracket" as a generic doesn't really work because "brackets" usually specifically means () in British English and [] in American English.

Seeing that you're naming a variable, I would probably go with $enclosures.

Parentheses is a plural; the singular is parenthesis.

"Parens" is usual and understandable, yes.

8
  • 18
    In British English, [] are "square brackets" and {} are "curly brackets", so they're all types of brackets, so to speak. Feb 26, 2011 at 15:32
  • 1
    @ShreevatsaR: Oh yes, indeed! I really wonder when/how parentheses came into American usage. It's such a long and cumbersome word!
    – Jimi Oke
    Feb 26, 2011 at 16:17
  • 1
    @Jimi Oke : I dont know but as the french word is the same ( "parenthèse") i can guess :D Feb 26, 2011 at 19:06
  • 5
    I hear { called curly braces a lot, rather than curly brackets.
    – Martin
    Feb 26, 2011 at 20:21
  • 2
    @Jimi Oke, “parenthesis” en.wikipedia.org/wiki/Parenthesis_%28rhetoric%29 originally referred to words contained within the enclosing marks, and then later came to also refer to the marks themselves.
    – nohat
    Feb 27, 2011 at 18:56
14

You can call all of them braces or call all of them brackets.

I have heard

  • [] called brackets, square brackets, and square braces;
  • {} called braces, curly braces, and curly brackets.
  • () called parentheses

While it's true I have never heard () referred to as "curved braces" or "curved brackets" or anything like that, it is fine to lump them in with other "enclosing punctuation" as other answers and comments suggest.

I specifically recommend against enclosing glyphs because it is a little too snooty, as if you're some kind of English show-off trying to talk to programmers about programming. I don't mind calling these symbols enclosures, though in programming contexts, this term might be a little too close to closures, which are something else.

Don't forget that <> are also common enclosures, referred to as angle brackets or angle braces.

Finally, so that this answer addresses everything asked, I'll reiterate that () are parentheses; one of them is a parenthesis; and that these can be freely shortened to parens and paren, respectively, especially when talking to programmers.

2
  • Very good answer. One of the thoughts informing my own answer above is that we have the terms "square brackets" and "angle brackets." Although you never see the term "curved brackets," it's very clear from the above that these things are all considered "brackets" of a type.
    – The Raven
    Feb 26, 2011 at 20:14
  • This is clearly the best answer.
    – airstrike
    Sep 8, 2016 at 21:01
9

These can be called "brackets."

Regarding the side questions, "marks of parenthesis" is the standard term, and parentheses is possible, but a bit breezy. "Parens" is the usual abbreviation.

9

In every IDE I've used, the concept of highlighting or validating matching enclosures has been referred to as brace-matching, so I would suggest brace as a candidate to cover all of the glyphs you mention.

A brace of things refers to a pair of something (the origin is from hunting), and is synonymous with pair.

6
  • 1
    It's also used specifically to refer to {}, unfortunately.
    – chaos
    Feb 26, 2011 at 15:43
  • @chaos: The symbol, {, is a brace and it's only referred to as such when it is used to indicate a relationship between two or more items, e.g. a linear system of equations, a system of music staves, etc. Braces would usually mean the pair, {}.
    – Jimi Oke
    Feb 26, 2011 at 16:21
  • 2
    @Jimi Oke I was brought up on the term "curly braces" for {}. Funny how oddly annoying it is to hear another term for this symbol! Feb 26, 2011 at 17:49
  • @chaos: Not really. Anyway, "glyph" is so broad as to be unusable.
    – Robusto
    Aug 12, 2016 at 0:46
  • @Robusto: I assure you it is, specifically among computer programmers following American linguistic conventions. Regarding your feedback, I'm not proposing glyph, I'm proposing enclosing glyph.
    – chaos
    Aug 14, 2016 at 0:26
7

Instead of "Enclosing glyphs", which sounds like something a technical standards organization would come up with to classify the symbols for something like Unicode, I'd suggest "grouping symbols." "Grouping symbols" may imply a mathematical usage, but I doubt that the association with math is very strong.

4

Wikipedia article on delimiters gives "Bracket delimiters (also block delimiters, region delimiters or balanced delimiters)..."

2

PairedPunctuationMarks is the clearest that I can come up with. However, as a programmer I would strongly urge you to name variables based on how they're used instead of what they are. It makes for easier to read code. So, if these symbols are going to be, say, part of the legal ways to delimit a certain kind of token in your code, a name like LegalUserInputDelimitersForFooRegex might be a better variable.

3
  • I like PairedPunctuationMarks, but it's quite long. Btw., the purpose of my var is to determine if a char is a PairedPunctuationMark and to find its counterpart if so.
    – maaartinus
    Feb 26, 2011 at 22:12
  • That's why we have IDEs with auto-complete. If this were my code it'd probably be CharsToCheckForClosingChar or something. Enjoy! Feb 26, 2011 at 23:11
  • 1
    Why not just use paired marks?
    – yunzen
    Jan 20, 2016 at 14:39

Not the answer you're looking for? Browse other questions tagged or ask your own question.