-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Clarify we mean UpperCamelCase, not lowerCamelCase #2389
Clarify we mean UpperCamelCase, not lowerCamelCase #2389
Conversation
Corresponding PR has been made to the api-guidelines repo |
At least wiki says both |
That would be equivalent to
Yes, many people misuse the terms, so this is an uphill battle on my part. However, I hope we'd agree that one of those is an idiomatic Rust type name and the other is not. We could choose to say "no, not that camel case, use the other camel case", or we could choose to use a distinct term that only means the one we want. One interesting thing that I've been mulling about regards WASM. In the JS ecosystem,
A good point, but we've previously deprecated / renamed lints that had names we no longer felt were appropriate. I hadn't thought of this case before, but I believe it could fit into the same category. We certainly wouldn't ever get rid of support for the existing lint name. |
In terms of prior art, I think it's also worth mentioning that the C# capitalization guidelines also make the distinction between PascalCase and camelCase. Oracle's Java recommendations dodge the issue by not naming the conventions. I think it's thoroughly more clear to have more-distinct names, too. I realize that we're not recommending the camelCase option for any identifiers in Rust, but it's certainly out there in other languages. I think having distinct terms that are shared across ecosystems is a win. |
FWIW, I personally prefer to call these "lower camel case" and "upper camel case" since it's hard to imagine how anyone could manage to misinterpret those terms, and the term "PascalCase" is significantly less famous than camel case. |
I'll just throw in that when I came across |
We should probably get @killercup's permission |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice PR. I have nothing against camels, and they regularly show up in the names of my variables in other languages, but something about this PR makes me smile.
My favorite out-of-context quote for the month. |
I've seen them called |
As a former Delphi programmer, I strongly support |
Might be worth adding that the Swift guidelines refer to this as |
Please merge or close this PR. I don't want it to remain in limbo forever. |
Personally, my vote is for 🐫 case, which has been what I have always heard it called... |
@alexcrichton @BurntSushi This is a pretty low effort RFC to nominate, either of you care to bring it up at the next libs team meeting? |
Ah we actually discussed this at the last triage meeting and forgot to comment! We concluded that good names for this would be UpperCamelCase and lowerCamelCase from a libs perspective, so this was largely turning into a docs issue and I'll reclassify to reflect that. |
I don't think we should call this "PascalCase"; informally, I'd say that I don't think that term has nearly the name recognition. And even "UpperCamelCase" doesn't seem clear except insofar as being self-documenting. We should just explain and/or define the terms we use in detail the first time we use them, which will make it clear even to people who haven't heard any of the terms before. We give examples in a table, but I don't think we have an explanation anywhere that actually says "capitalize the first letter of each word". |
e55b330
to
633de5f
Compare
I may have forgotten about this PR for a while. I've removed all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Libs team has discussed this in a previous meeting -- #2389 (comment) -- so this looks good to me. Thanks!
Rust structs should be named in upper camel case aka PascalCase. "Upper camel case" was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Rust structs should be named in upper camel case aka PascalCase. "Upper camel case" was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Rust structs should be named in upper camel case aka PascalCase. “Upper camel case” was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Rust structs should be named in upper camel case aka PascalCase. “Upper camel case” was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Rust structs should be named in upper camel case aka PascalCase. “Upper camel case” was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Rust structs should be named in upper camel case aka PascalCase. "Upper camel case" was decided upon as the preferred phrase over PascalCase per: rust-lang/rfcs#2389
Brings the terminology in line with the rest of the project, see <rust-lang/rfcs#2389>. Connects to #2194.
Rust is the first time I've heard of UpperCamelCase in 500 years of coding. I'm sad it's not called PascalCase here too. |
@nodingneu that's wonderful! I'm glad that we got to be a small part of your learning today. I hope that when I am 500 years old I am still able to learn something new every day as well. Have an enriching learning journey! |
* Typo Typo, filename is now file_path. * rst restore `value` * Fix broken nostarch URL * Change CamelCase to UpperCamelCase Brings the terminology in line with the rest of the project, see <rust-lang/rfcs#2389>. Connects to rust-lang#2194. * Update to Rust 1.66.1 * Update to Rust 1.67.1 * Removed "," typo on ch03-01 line 85 Removed extra comma on line 85. We’ll cover types and type annotations in the next section, “Data Types`,`”, so don’t worry about the details right now. * simplify COPYRIGHT file * Fix grammar Add the word 'of' to fix the grammar. * Update copyright in LICENSE-APACHE Looks like we forgot to fill this in when we added the license file. ;) * Correct `i32` formatting in ch19-05 * Remove adjective about what kind of number this is * Improve sentence * Small wording changes * redirects: change link for `#![no_std]` tutorial * Fix cargo doc links * Prepare for removal of compiler plugin support. rust-lang/rust#116412 will remove support for compiler plugins from rustc, which includes the entry in The Rust Unstable Book. This commit removes a link to that entry so it won't be broken when that PR merges. * Fix mdBook links * Fixed 'troubleshooting' link * Update ch01-02-hello-world.md * Update ch01-02-hello-world.md --------- Co-authored-by: abiphone <[email protected]> Co-authored-by: printfn <[email protected]> Co-authored-by: Carol (Nichols || Goulding) <[email protected]> Co-authored-by: Mateus Rodolfo <[email protected]> Co-authored-by: Pietro Albini <[email protected]> Co-authored-by: Vishal Lama <[email protected]> Co-authored-by: Jason Walton <[email protected]> Co-authored-by: Shinya Fujino <[email protected]> Co-authored-by: Jaime Terreu <[email protected]> Co-authored-by: Mike Krisher <[email protected]> Co-authored-by: kadiwa <[email protected]> Co-authored-by: Eric Huss <[email protected]> Co-authored-by: Nicholas Nethercote <[email protected]> Co-authored-by: Marcus Stollsteimer <[email protected]> Co-authored-by: Aryan Malik <[email protected]>
Because it looks like a camel with a single hump in the middle: 🐪