Normative: use Numbers instead of reals as counters in Iterator builtins#3776
Open
michaelficarra wants to merge 1 commit intomainfrom
Open
Normative: use Numbers instead of reals as counters in Iterator builtins#3776michaelficarra wants to merge 1 commit intomainfrom
michaelficarra wants to merge 1 commit intomainfrom
Conversation
|
The rendered spec for this PR is available as a single page at https://tc39.es/ecma262/pr/3776 and as multiple pages at https://tc39.es/ecma262/pr/3776/multipage . |
Member
|
In #2007 we discussed the issue of counters and IIRC agreed that we should specify them as mathematical values with the understanding that implementations would diverge in the same way they diverge from the requirements to have arbitrarily large strings and callstacks and similar. I think that's better than this. |
Member
Author
|
Even JSSE, the entirely AI-generated engine, gets this wrong: https://github.com/pmatos/jsse/blob/main/src/interpreter/builtins/iterators.rs. I guess it didn't read the spec... |
56466b4 to
a5e3a69
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All known engines are currently non-compliant. If they use Numbers as counters today, they'll stop advancing at 253. So counters passed to user-provided callbacks will always be 253 once they reach that point and take/drop will behave as if Infinity was passed. With this change, internal counters are now Numbers, so the argument passed to user-provided callbacks is expected to repeat at 253 (matching implementations today). In addition, take/drop throw a RangeError on finite inputs ≥ 253.
See tc39/proposal-iterator-includes#12 for context.