-
Notifications
You must be signed in to change notification settings - Fork 0
Add draft spec text #5
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
Conversation
|
The rendered spec for this PR is available at https://tc39.es/proposal-typedarray-findwithin/pr/5. |
1ccd9c7 to
bd79d79
Compare
9f904b9 to
db7daad
Compare
bakkot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than comment. I think later we might want to either define an AO for "SameValueZero-equal" or at least rephrase and put it somewhere which can be shared, but it's fine for now.
Also I continue to think these should all take an offset parameter, but that can be a followup.
|
Oh, and I also (weakly) still think the needle should be any iterable, which will be much more annoying to specify. But again, that can be a followup if that's the direction we decide to go. |
This comment was marked as resolved.
This comment was marked as resolved.
bce0c5f to
b8f65ae
Compare
245e216 to
088572c
Compare
088572c to
0d2d06c
Compare
730787d to
72bb2b4
Compare
|
Given that the conversation appears to have settled out, I'd like to get this draft text landed. Any objections? |
| 1. If _needleLength_ is 0, return 𝔽(_position_). | ||
| 1. If _direction_ is ~first~, then | ||
| 1. If _position_ + _needleLength_ > _haystackLength_, return *-1*<sub>𝔽</sub>. | ||
| 1. [id="step-search-first"] Return the smallest integer _k_ such that _k_ ≥ _position_ and SequenceSameValueZeroEqual(the List of elements of _typedArray_ from index _k_ to _k_ + _needleLength_ - 1, _needle_) is *true*, or *-1*<sub>𝔽</sub> if no such _k_ exists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Editors discussed this at editor call and would still like to see this spelled out, either as nested loops or a single loop, as in StringIndexOf with a substring equivalent for TypedArrays. But this text is fine for reaching Stage 2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, assuming we are able to advance to stage 2, I'll include that as a step to get to 2.7. Does that work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, editor approval is required for 2.7, so it's kind of implied, but sure, if you like.
|
Merge it. |
No description provided.