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

fix #11 #12

Merged
merged 3 commits into from
Jan 16, 2023
Merged

fix #11 #12

merged 3 commits into from
Jan 16, 2023

Conversation

JojiiOfficial
Copy link
Contributor

@JojiiOfficial JojiiOfficial commented Jul 22, 2022

Fixes #11

Copy link
Owner

@PSeitz PSeitz left a comment

Choose a reason for hiding this comment

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

sorry for the late review, I forgot about the PR

return false;
}
input.chars().all(is_char_hiragana)
!input.is_empty() && input.chars().all(is_char_hiragana)
Copy link
Owner

Choose a reason for hiding this comment

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

I think the previous version is more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imo this is cleaner as the function represents a single bool expression that is written there. But I actually didn't intend to put this into this PR.

Copy link
Owner

Choose a reason for hiding this comment

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

The single bool expression is the reason why it's less readable.
What happens on empty input? -> need to look at the whole bool expression instead of one line

What happens on other input? -> need to look at the whole bool expression instead of one line

Clean is quite subjective, but according to the "Clean Code" book this is discouraged (The Stepdown Rule)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah its indeed pretty subjective and as I didn't intend to PR this part anyways I'm fine with keeping it the way it was. I just changed it while going through the code when adjusting the lib for my needs.

Copy link
Owner

Choose a reason for hiding this comment

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

can you update the PR? LGTM to me, except the bool expression


[dev-dependencies]
speculate = "0.1.2"

[features]
enable_regex = ["regex"]
tokenize = ["itertools"]
default = []
Copy link
Owner

Choose a reason for hiding this comment

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

tokenize should be a default feature

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 personally use this only to convert kana and I think there lots of users of wanakana use it for this purpose only as well. But this also wasn't intended to be added to this pr.

Copy link
Owner

Choose a reason for hiding this comment

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

I have no problem to add this to the lib. Is there a problem with the itertools dependency? (no_std support?)

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 just prefer to have as less dependencies as possible in my code or better said I see it as a good practice to keep them as few as possible and I don't need tokenize in my current project.

return false;
}
input.chars().all(is_char_japanese)
!input.is_empty() && input.chars().all(is_char_japanese)
Copy link
Owner

Choose a reason for hiding this comment

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

I think the previous version is more readable

@PSeitz
Copy link
Owner

PSeitz commented Jan 16, 2023

Thanks!

@PSeitz PSeitz merged commit 44e686c into PSeitz:master Jan 16, 2023
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.

Panic
2 participants