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

Change substring semantics to be about positions, not indices #404

Merged
merged 1 commit into from Sep 22, 2021

Conversation

domenic
Copy link
Member

@domenic domenic commented Sep 21, 2021

Previously, the spec attempted to use code unit/point indices in the substring definitions. However, this mismatched how most programming languages do substring operations, and was buggy, as noted in #402.

This changes the definitions to operate on "positions" between code units/points, instead of indices, with a note explaining the difference. The resulting prose then matches most programming languages, as well as the JavaScript specification's less-formal "substring" definition.

Closes #402.

Thanks @triple-underscore! Your review would be appreciated.

Fixes to other specs:


Preview | Diff

domenic added a commit to domenic/service-worker-scope-pattern-matching that referenced this pull request Sep 21, 2021
@domenic domenic requested a review from annevk September 21, 2021 20:53
Previously, the spec attempted to use code unit/point indices in the substring definitions. However, this mismatched how most programming languages do substring operations, and was buggy, as noted in #402.

This changes the definitions to operate on "positions" between code units/points, instead of indices, with a note explaining the difference. The resulting prose then matches most programming languages, as well as the JavaScript specification's less-formal "substring" definition.

Closes #402.
@domenic domenic merged commit 9323562 into main Sep 22, 2021
@domenic domenic deleted the substring-fix-again branch September 22, 2021 15:46
@whatwg whatwg deleted a comment from Glite1 Oct 9, 2021
@whatwg whatwg deleted a comment from Glite1 Oct 9, 2021
@whatwg whatwg deleted a comment from Glite1 Oct 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect code unit/code point substring definitions
3 participants