4 ms·
Who says the criteria for separating parts of programming language identifiers need be dictated by whether the words are separated by spaces in English? The "m
by daviddaviddavid 12y ago
Who says the criteria for separating parts of programming language identifiers need be dictated by whether the words are separated by spaces in English?
The "mistakes" here are all examples of phrasal verbs:
http://en.wikipedia.org/wiki/Phrasal_verb http://en.wikipedia.org/wiki/Phrasal_verb
The central characteristic of these constructions is that the verb+preposition form "a single semantic unit".
That would seem to be a perfectly reasonable justification for not introducing underscores.
- dragonwriter 12y ago> Who says the criteria for separating parts of programming language identifiers need be dictated by whether the words are separated by spaces in English? Many coding standards specify different presentation for single-word vs multi-word identifiers, except in languages where the syntax would prevent this (e.g., snake-, Pascal-, or camel-case presentation of multi-word identifiers.) All the examples are phrasal verbs, presented as single words in identifiers that are using snake_case or camelCase to distinguish multiple words in the identifier, and so are incorrect. The only times I can see this being anything more than a mild aesthetic issue (though still a real issue that, while perhaps not the most critical to address, is worth being aware of and avoiding) is if it is in a language where, e.g., properties and methods share a single namespace, and coding standards dictate that properties use noun-based names and methods use verb-based names. In that case, using a single-word noun in an identifier when you intend a phrasal verb is a substantive error (most particularly when that semantic unit is the whole of the identifier).