rust-rgb
rust-rgb copied to clipboard
CamelCase for acronym typenames?
Rust's RFC 0430 about naming conventions says:
In
CamelCase
, acronyms count as one word: useUuid
rather thanUUID
.
For consistency among other codes, I think RGB
and RGBA
should be Rgb
and Rgba
.
(RGBA
looks like a constant rather than a type.)
What do you think?
I have conflicted feelings about this.
On one hand, it'd be nice to follow an official recommendation. OTOH that looks weird to me. In non-Rust languages it's RGB
or rgb
, but I don't remember ever seeing Rgb
.
I think same-language conventions have greater value for code readability than across-language conventions. As such I am in favor of this change.
Also worth adding the RGB8
-> RgbU8
suggestion from #62 here for visibility.
Yeah, I'm not sure about this. RGB
is a super-common acronym, and the Rgb
spelling is mostly a Rust convention, and it looks odd to me especially when not part of a CamelCase
name. RGB8
is widely recognized in the industry, and RgbU8
is a Rusty neologism.
So I'm torn between being consistent with Rust vs consistent with pretty much everything except Rust.
It is possible to support both, by re-exporting the other with #[doc(hidden)]
, but one of them needs to be chosen as the canonical. I'm still leaning towards RGB
and RGB8
.
RGB is a super-common acronym
HTML
, CSS
, HTTP
are all commonly-known acronyms, but crates that implement their types all use the rust naming conventions for types using them such as Http in hyper
, Css in cssparser
, and Html in html
. To break this language convention is the greater surprise in my opinion.
The principle of least surprise.
Since you are split fairly evenly between the two options can I suggest we default to Rgb
since that is likely to be more familiar to the target-audience of this library (rust-developers) as opposed to the greater industry?
OK, that makes sense