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

rename covers to is_start_of #57

Merged
merged 1 commit into from
May 3, 2018
Merged

Conversation

rushmorem
Copy link
Contributor

@rushmorem rushmorem commented May 3, 2018

EDIT: Updated as per conversation with @bluejekyll and @yjh0502.

@rushmorem
Copy link
Contributor Author

rushmorem commented May 3, 2018

The failing tests are unrelated to this change. They are due to rust-lang/rust@671b2a5 which will be fixed by rust-lang/rust-clippy#2713.

@yjh0502 yjh0502 requested a review from bluejekyll May 3, 2018 11:05
/// indicating that the Subspace logically contains the key.
pub fn covers(&self, key: &[u8]) -> bool {
pub fn starts_with(&self, key: &[u8]) -> bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern, and the reason I didn't use starts_with, is that usually the semantics of starts_with is to take a prefix and see if the self has that at it's start, in this implementation we're checking if the key starts with self.

This is why I was hesitant to use this before. We discussed an other option, but @yjh0502 was less enthused with it: is_prefix_of. Another option would be is_start_of.

Does my concern make sense?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't realized that point. I'm okay with all those names, but if I have to choose one of those, I prefer covers :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this implementation we're checking if the key starts with self

Ah, I see. That, indeed, makes sense. In that case I think I like is_prefix_of or is_start_of more than covers because to me covers is a bit vague. Those 2 explain the relationship more clearly.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so splitting the difference, should we just land on is_start_of?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that. Let me update the PR.

@rushmorem rushmorem changed the title rename covers to starts_with rename covers to is_start_of May 3, 2018
@bluejekyll bluejekyll merged commit 7d72798 into Clikengo:master May 3, 2018
@rushmorem rushmorem deleted the rename-covers branch May 3, 2018 18:16
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

Successfully merging this pull request may close these issues.

3 participants