Pluralizing keywords in programming languages [duplicate]

  1. You're not.

  2. If you're consistent about how you do it, it doesn't really matter how you do it. I would go for trys or "try"s, though, because

  3. You should never inflect a keyword (tries), just like you shouldn't capitalise it at the start of a sentence ("Try is for exceptions"), especially in the most common case that the language is case-sensitive; keywords are taken painfully literally by a compiler, so literature must reproduce them with painstaking exactness.

As VonC states, it's probably best to just re-word, though as the convention with functions is to append parentheses (foo()), you might try appending braces if your language is block-delimited:

No implementation for global-level try{}s.

I would rather leave any language keyword alone (as in "non pluralized"), and convey the pluralization otherwise, like:

No implementation for all global level "try".

or

No implementation for any global level "try".


I believe the difficulty you're having is because although we use English words as the basis for programming languages, once they are used as such they are no longer English Words, but are tokens, identifiers or otherwise non-English symbols.

This being the case, the rules of English usage can no longer be applied as if this was still a "word" used as the part of speech your "ear for English" would expect. Enclosing the item in quotes, as suggested by VonC highlights the fact that the item in question has evolved into a non-English object.


There is in fact a very long-standing pluralisation rule that apostrophes can be used to pluralise words that are used as themselves, rather than in terms of what they signify. For example, "No if's and but's". ("Do's and don'ts" complicates it by avoiding a double apostrophe in the second case, though that's also sometimes found).

It's a rule that some style-guides recommend against, particularly if style (italics for words used as here, a monospace font for computer keywords) already does the job of making the word stand apart from the pluralising s, but it certainly is valid.

Your "try's" would be analogous.

I would though, personally prefer the likes of "trys", where font-change is used. The cases where apostrophes are used in plurals are less and less common, and the use of a different font to highlight when a computer context is intended will make other passages clearer too.