Uh oh!
There was an error while loading. Please reload this page.
RFC: Finalizing more naming conventions - #430
Conversation
d170748 to
f925a6fCompareThere was a problem hiding this comment.
I think we should consider CamelCase for constants, since SCREAMING_SNAKE_CASE is extremely abrasive to look at and it more clearly demonstrates the difference.
There was a problem hiding this comment.
Note that there are precedents in both directions here, and I'm not sure it's clear that we should draw a distinction between these two kinds of variables.
Looking around, we've got:
I'll also point out that "SCREAMING_SNAKE_CASE" is abrasive probably because it has the word "screaming" in all caps. Something like MAX_WIDTH vs MaxWidth seems less abrasive to me
There was a problem hiding this comment.
I was going to use enums to represent keys in a termbox-like console input library, but it turns out that Ctrl-I and Tab keys map to the same escape sequence so I'll have to use CTRL_I and TAB instead of CtrlI and Tab now if I want to use it in a match :(
glaebhoerl
commented
Nov 3, 2014
I think |
brendanzab
commented
Nov 3, 2014
Yup. I agree with @glaebhoerl on this. Either that or make variants screaming, but I don't think anyone wants that! |
arcto
commented
Nov 3, 2014
I agree with @glaebhoerl in that constants and enum variants should share the same I think it's fair though that static variables stand out (using |
glaebhoerl
commented
Nov 3, 2014
That's the other idea I was going to float... perhaps it might make sense to distinguish mutable |
brson
commented
Nov 3, 2014
This discusses acronyms in camel case but not snake case: e.g. |
netvl
commented
Nov 5, 2014
Especially big +1 for |
thepowersgang
commented
Nov 18, 2014
Just to leave my two cents on the topic of statics. I'm all for "screaming case" (Caps) for constants, but for interior mutable data (StaticMutex) using snake case would be preferable. [Similar to @glaebhoerl's comment] |
glaebhoerl
commented
Nov 18, 2014
(That's actually the reverse of my comment.) |
nikomatsakis
commented
Nov 18, 2014
Isn't the convention not |
aturon
commented
Nov 18, 2014
Good catch! This was leftover from the original wiki that I started with. I will update. |
brson
commented
Nov 18, 2014
Accepted. Discussion. Tracking. |
brson
commented
Nov 18, 2014
Accidentally rebased this instead of merged. |
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: rust-lang/rfcs#430 [breaking-change] Closesrust-lang#13159 cc rust-lang#19091
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: rust-lang/rfcs#430 [breaking-change] Closesrust-lang#13159 cc rust-lang#19091
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: rust-lang/rfcs#430 [breaking-change] cc #19091
Apply conventions described in [Rust RFC 430][rfc] where `unwrap` is reserved for panicing methods. [rfc]: rust-lang/rfcs#430
This change applies the conventions to unwrap listed in [RFC 430][rfc] to rename non-failing `unwrap` methods to `into_inner`. This is a breaking change, but all `unwrap` methods are retained as `#[deprecated]` for the near future. To update code rename `unwrap` method calls to `into_inner`. [rfc]: rust-lang/rfcs#430 [breaking-change] Closes #13159 cc #19091
chpiatt
commented
Oct 12, 2019
Just came here to point out that ThisNamingConvention is more accurately referred to as Pascal Case. In the documentation you refer to it as Camel Case, which more commonly follows thisPattern. |
gomesalexandre
commented
Jan 13, 2020
Hey, just came here to state the same thing as @Pyython. You refer to |
nikomatsakis
commented
Jan 13, 2020
By docs, do you mean the RFC? Ideally, we'd have these docs living somewhere else and update there, but I'm not sure if they do. We don't generally modify the text of RFCs heavily after they're landed, prefering to keep more stable docs up to date. |
This conventions RFC tweaks and finalizes a few long-running de facto
conventions, including capitalization/underscores, and the role of the
unwrapmethod.See this RFC for a competing proposal for
unwrap.Rendered
Note: Though marked as closed, this RFC was in fact accepted.