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

is_western_chars_only in utf8_util.v? #19777

Open
2 tasks
verulian opened this issue Nov 5, 2023 · 3 comments
Open
2 tasks

is_western_chars_only in utf8_util.v? #19777

verulian opened this issue Nov 5, 2023 · 3 comments
Labels
Feature Request This issue is made to request a feature.

Comments

@verulian
Copy link
Contributor

verulian commented Nov 5, 2023

Describe the feature

I noticed that @JalonSolov made some cleanup changes to https://github.com/vlang/v/blob/master/vlib/encoding/utf8/utf8_util.v about western-only encoding. Am I missing the logic here or are we missing a function like "is_western_chars_only" that would test a string to ensure that it is western only before performing operations? Initially hwen I look at this it seems the programmer needs to know if it is or should be this only, but it might be easier if this is used many times to have a simple test to ensure westernness of the string before performing operations.

Use Case

If western-only operations are used multiple times it would be better to have a test available to ensure westernness of the variable in question vs depending on developer awareness. If it is a one-off this might not make sense, but if there are many it might make sense.

Proposed Solution

Parse/test string to ensure westernness or non-westernness.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

current

Environment details (OS name and version, etc.)

n/a

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@verulian verulian added the Feature Request This issue is made to request a feature. label Nov 5, 2023
@JalonSolov
Copy link
Contributor

All I changed in that section was the comment style. The code there is the same as it has been for a long time.

The comments are somewhat misleading... "western" just means ASCII codes, and the first 128 UTF-8 codes == ASCII codes.

I can't think of a reason why we would need an "is_western_chars_only" check.

@verulian
Copy link
Contributor Author

verulian commented Nov 6, 2023

I guess thinking of just the speed diff betwixt western and !western only for large iteration scenarios might be useful but I will close if this is nonsensical which seems you are indicating.

@verulian verulian closed this as completed Nov 6, 2023
@JalonSolov
Copy link
Contributor

JalonSolov commented Nov 6, 2023

I don't know. If you have a valid use-case, please show it. All I said was I can't think of one.

@JalonSolov JalonSolov reopened this Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request This issue is made to request a feature.
Projects
None yet
Development

No branches or pull requests

2 participants