Skip to content
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

CamelCase for acronym typenames? #25

Open
Tracked by #64
lo48576 opened this issue Jul 28, 2019 · 6 comments
Open
Tracked by #64

CamelCase for acronym typenames? #25

lo48576 opened this issue Jul 28, 2019 · 6 comments

Comments

@lo48576
Copy link

lo48576 commented Jul 28, 2019

Rust's RFC 0430 about naming conventions says:

In CamelCase, acronyms count as one word: use Uuid rather than UUID.

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?

@kornelski
Copy link
Owner

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.

@ripytide
Copy link

I think same-language conventions have greater value for code readability than across-language conventions. As such I am in favor of this change.

@ripytide ripytide mentioned this issue May 23, 2024
19 tasks
@ripytide
Copy link

Also worth adding the RGB8 -> RgbU8 suggestion from #62 here for visibility.

@kornelski
Copy link
Owner

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.

@ripytide
Copy link

ripytide commented May 23, 2024

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?

@kornelski
Copy link
Owner

OK, that makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants