-
Notifications
You must be signed in to change notification settings - Fork 704
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TV is an abbreviation for television, why TVVcr
is good but TvVcr
is bad?
#4111
Comments
cc: @parlough what are your thoughts on the expected fix? |
Thanks for catching this @yujinlin0224, this seems to make sense to me. It seems useful to illustrate this combination of an acronym that is two letters than one that is not, so perhaps we can find a good replacement that fits with the others rather than swapping these. |
I'm not a native English speaker, so I may be wrong, here is my personal opinion: Rather than using acronyms and abbreviations to distinguish between rules, I prefer to use the source of the letters to distinguish or the pronunciation to distinguish.
In addition to choosing one of these two rules, if acronym or abbreviation is not in the begin or end of variable, just use general camel case rule and treat as a single word:
To me it would make more sense to use the pronunciation to differentiate, but it will breaks some words like |
Thanks for your detailed thoughts @yujinlin0224! I'll rope in @munificent as these are his guidelines to see what he thinks. It sounds like a simple modification to make it more clear would be making the exception be about initialisms (abbreviations that are sounded out by the letter) rather than acronyms. |
Honestly... I think the real underlying rule here is just that Maybe we should just write to say that |
Consider the main documentation style guide: it considers the correct usage to be |
That's the guidance for documentation. In doc comments and string literals, yes, you should write it as "ID". Likewise, you should fully capitalize "HTTPS" and "NASA". But the guidance this issue is talking about is abbreviations appearing in identifiers. That has different capitalization rules from normal English grammar. |
OK, let's back up. The docs as written are correct but unclear. The heading confuses the issue. Perhaps it should be separated into two sections.
|
My understanding is of the terminology is:
I think that "DB" is more or less an initialism because the term was originally "data base" before becoming fused as "data-base" and then "database" (which is a common process in English). I don't know how to characterise "TV" since "television" has always been a single word and "tele" isn't a meaningful standalone word. It seems like it should be best considered a non-initialism abbreviation. But we wouldn't want it to be "TvVcr" in Dart. Oh, wait, I've got it now. The linguistic category is a red herring. All we need to care about is whether it is all caps in English. I think the rule can just be: DO capitalize acronyms and abbreviations longer than two letters like words. Capitalized acronyms can be hard to read, and multiple adjacent acronyms can lead to ambiguous names. For example, given an identifier Two-letter abbreviations and acronyms are the exception. If both letters are capitalized in English, then they should both stay capitalized when used in an identifer. Otherwise, capitalize it like a word. Examples:
When an abbreviation of any form is at the beginning of a lowerCamelCase identifier, it is lowercased: var httpConnection = connect();
var tvSet = Television();
var mrRogers = 'hello, neighbor'; |
Thanks for your contribution! Please replace this text with a description of what this PR is changing or adding and why, list any relevant issues, and review the contribution guidelines below. Fixes #4111 --- - [ ] I’ve reviewed the contributor guide and applied the relevant portions to this PR. - [ ] This PR doesn't contain automatically generated corrections or text (Grammarly, LLMs, and similar). - [ ] This PR follows the [Google Developer Documentation Style Guidelines](https://developers.google.com/style) — for example, it doesn't use _i.e._ or _e.g._, and it avoids _I_ and _we_ (first person). - [ ] This PR uses [semantic line breaks](https://github.com/dart-lang/site-shared/blob/main/doc/writing-for-dart-and-flutter-websites.md#semantic-line-breaks) of 80 characters or fewer. <details> <summary>Contribution guidelines:</summary><br> - See our [contributor guide](https://github.com/dart-lang/site-www/blob/main/CONTRIBUTING.md) for general expectations for PRs. - Larger or significant changes should be discussed in an issue before creating a PR. - Code changes should generally follow the [Dart style guide](https://dart.dev/effective-dart) and use `dart format`. - Updates to [code excerpts](https://github.com/dart-lang/site-shared/blob/main/doc/code-excerpts.md) indicated by `<?code-excerpt` need to be updated in their source `.dart` file as well. </details> --------- Co-authored-by: Marya <[email protected]>
Page URL
https://dart.dev/guides/language/effective-dart/style
Page source
https://github.com/dart-lang/site-www/blob/d2d436b3ca51bbd08df4e8f77464aaa8944e297d/src/_guides/language/effective-dart/style.md
Describe the problem
In DO capitalize acronyms and abbreviations longer than two letters like words says
TV is an abbreviation for television, why
TVVcr
is good butTvVcr
is bad?Expected fix
Change
TVVcr
to bad andTvVcr
to goodAdditional context
No response
The text was updated successfully, but these errors were encountered: