Skip to content

Define string cursors to be code unit offsets#16

Merged
wingo merged 2 commits into
mainfrom
code-units
Oct 29, 2021
Merged

Define string cursors to be code unit offsets#16
wingo merged 2 commits into
mainfrom
code-units

Conversation

@wingo
Copy link
Copy Markdown
Owner

@wingo wingo commented Oct 28, 2021

Change the specification to define a cursor value as being a code unit offset. Note that the meaning of "code unit" depends on how the host represents strings; for UTF-8 it's a byte, for UTF-16 a value in [0,0xFFFF], and for UTF-32 it's a whole codepoint.

Three fundamental reasons to make this change:

  • eliminate differences in behavior between different web browsers
  • allow hosts to reason about string offsets
  • define a meaning for cursor values for UTF-8 hosts

Fixes #11.

Change the specification to define a cursor value as being a code unit
offset.  Note that the meaning of "code unit" depends on how the host
represents strings; for UTF-8 it's a byte, for UTF-16 a value in
[0,0xFFFF], and for UTF-32 it's a whole codepoint.

Three fundamental reasons to make this change:
  - eliminate differences in behavior between different web browsers
  - allow hosts to reason about string offsets
  - define a meaning for cursor values for UTF-8 hosts

Fixes #11.
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md Outdated
@wingo
Copy link
Copy Markdown
Owner Author

wingo commented Oct 28, 2021

wdyt @jakobkummerow ?

@jakobkummerow
Copy link
Copy Markdown

LGTM

@wingo wingo merged commit 949afd0 into main Oct 29, 2021
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.

Implementation-specified or unspecified string cursor values are a hazard

3 participants