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

[API design] Remove ability to operate on parts of a CharSequence via startIndex and endIndex? #39

Open
cketti opened this issue Jun 23, 2024 · 0 comments

Comments

@cketti
Copy link
Owner

cketti commented Jun 23, 2024

I've been going back and forth on whether to include functions that support a start and end index to only operate on part of a CharSequence. I've landed on not including/removing such functionality.

Reasons for this are:

  • It keeps the API surface small(er).
  • CharSequence.codePointAt() can be used without special handling at the end of a partial sequence.
  • For a caller it's easy enough to use CharSequence.subSequence().
  • Most Java and Kotlin APIs don't support providing a start and end index either, e.g. CharSequence.forEach()

For feature parity with Java's String.codePointCount(int, int) our CharSequence.codePointCount() will be an exception and continue to support a start and end index.

Before changing CharSequence.codePointIterator(Int, Int) to remove the parameters, I'd like to hear arguments from people who wish for the library to keep supporting operations with a start and end index.

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

No branches or pull requests

1 participant