uuid-rs / uuid

Generate and parse UUIDs.
https://www.crates.io/crates/uuid
Other
1.01k stars 192 forks source link

Idiotmatic naming: drop/replace `get_` prefixes #725

Closed virtualritz closed 8 months ago

virtualritz commented 10 months ago

See "Getter names follow Rust convention (C-GETTER)".

Suggestion:

  1. Strip resp. functions of the get_ prefix.
  2. Create functions that have the old names and are marked #[deprecated()] and #[inline(always)] and have them plain call the stripped ones.
  3. If those functions had this prefix to indicate that they do work (vs. plain getters that just return a copy of a struct member), consider using the to_ prefix instead.

Specifically:

KodrAus commented 10 months ago

Thanks for the suggestion @virtualritz :+1: This has come up before and although those names are more idiomatic with modern Rust (and if I were writing them today I would definitely use to_ rather than get_), we opted not to churn them because they've already been in that form for years.

virtualritz commented 10 months ago

I understand. Hence my suggestion with keeping the old names and adding deprecation warnings.

It's one of the perks of Rust that the language supports this natively. :]

Suffice to say I'd make a PR with those changes – if it had any chance of being accepted.

KodrAus commented 10 months ago

At some point I think we’ll probably release a semver compatible 2.0 that cleans up our module layout and feautes a bit. I think that would also be a good time to do this deprecation. In a major release you’d typically just make breaking changes, but for uuid I’m trying to maintain strict backwards compatibility so you can feel confident using Uuid in public APIs.

KodrAus commented 8 months ago

We don't have anything actionable here in the near future so I'll go ahead and close this one to keep our issue list current, but is something worth revisiting if we do come around to a 2.0