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?
I need to name a variable containing ()[]{}
, what is the common name for all of them?
Two side questions:
parens
understandable?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.
[]
are "square brackets" and {}
are "curly brackets", so they're all types of brackets, so to speak.
Feb 26, 2011 at 15:32
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.
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.
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.
{
, 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, {}
.
{}
. Funny how oddly annoying it is to hear another term for this symbol!
Feb 26, 2011 at 17:49
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.
Wikipedia article on delimiters gives "Bracket delimiters (also block delimiters, region delimiters or balanced delimiters)..."
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.
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.
Feb 26, 2011 at 22:12