Skip to content

Conversation

@jasnell
Copy link
Collaborator

@jasnell jasnell commented Feb 4, 2026

No description provided.

@jasnell jasnell requested a review from ljharb February 4, 2026 04:45
@github-actions
Copy link

github-actions bot commented Feb 4, 2026

The rendered spec for this PR is available at https://tc39.es/proposal-typedarray-findwithin/pr/5.

@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from 1ccd9c7 to bd79d79 Compare February 4, 2026 05:03
@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from 9f904b9 to db7daad Compare February 4, 2026 05:19
Copy link
Member

@bakkot bakkot left a 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.

@bakkot
Copy link
Member

bakkot commented Feb 4, 2026

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.

@jasnell

This comment was marked as resolved.

@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from bce0c5f to b8f65ae Compare February 6, 2026 01:30
@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from 245e216 to 088572c Compare February 6, 2026 06:00
@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from 088572c to 0d2d06c Compare February 6, 2026 06:05
@jasnell jasnell force-pushed the jasnell/add-spec-draft branch from 730787d to 72bb2b4 Compare February 6, 2026 21:31
@jasnell
Copy link
Collaborator Author

jasnell commented Feb 11, 2026

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_ &gt; _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.
Copy link
Member

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.

Copy link
Collaborator Author

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?

Copy link
Member

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.

@michaelficarra
Copy link
Member

Merge it.

@jasnell jasnell merged commit 4e4c927 into main Feb 11, 2026
1 check passed
@jasnell jasnell deleted the jasnell/add-spec-draft branch February 11, 2026 23:51
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.

4 participants