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

BTree: improve public descriptions and comments #91749

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

ssomers
Copy link
Contributor

@ssomers ssomers commented Dec 10, 2021

BTreeSet has always used the term "value" next to and meaning the same thing as "elements" (in the mathematical sense but also used for key-value pairs in BTreeMap), while in the BTreeMap sense these "values" are known as "keys" and definitely not "values". Today I had enough of that.

r? @Mark-Simulacrum

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 10, 2021
@camelid camelid added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Dec 11, 2021
@Mark-Simulacrum
Copy link
Member

Hm, elements feels like a not significant improvement over values, I feel like it's easy to read that as values, not the keys -- maybe something like "key-value pairs" is more clear cut?

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 12, 2021
@ssomers
Copy link
Contributor Author

ssomers commented Dec 12, 2021

I don't understand what you mean at all. But I didn't look beyond math and btree.

  • In math, sets have elements.
  • In BTreeSet, they are publicly called "values" often, sometimes "elements", and behind the scenes "keys".
  • Vec contains… "values" (doh!).
  • HashSet consistently goes for "elements" (phew). It also uses "keys" for hashing specifics. It mentions "value" but never meaning "element".
  • BTreeMap mostly lists "key-value pairs" and sometimes "elements" (actually, twice).
  • HashMap also lists mostly "key-value pairs" and sometimes "elements".

If you agree "values" is confusing, obvious names are "elements" or "keys". "key-value pairs" makes no sense to me - it's BTreeSet<T>, not BTreeSet<K, V>.

@Mark-Simulacrum
Copy link
Member

Ah, I think I somehow intuited this was modifying both map and set. For set I agree elements seems good, apologies for the confusion.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 12, 2021

📌 Commit 27b4b19 has been approved by Mark-Simulacrum

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 12, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 13, 2021
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#91086 (Implement `TryFrom<&'_ mut [T]>` for `[T; N]`)
 - rust-lang#91091 (Stabilize `ControlFlow::{is_break, is_continue}`)
 - rust-lang#91749 (BTree: improve public descriptions and comments)
 - rust-lang#91819 (rustbot: Add autolabeling for `T-compiler`)
 - rust-lang#91824 (Make `(*mut T)::write_bytes` `const`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 87cda67 into rust-lang:master Dec 13, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 13, 2021
@ssomers ssomers deleted the btree_comments branch December 13, 2021 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants