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

Editorial: Using non-negative integral Number instead of integral Number in ToLength #3377

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

tmdghks
Copy link
Contributor

@tmdghks tmdghks commented Jul 24, 2024

In current ECMA262 specification, the abstract operation ToLength returns a integer or throw completion.
However, I think that type of the return value of ToLength can be narrowed to a non-negative integer or throw completion.

@tmdghks tmdghks changed the title Using non-negative integer instead of integer in ToLength Editorial: Using non-negative integer instead of integer in ToLength Jul 24, 2024
@jmdyck
Copy link
Collaborator

jmdyck commented Jul 24, 2024

In current ECMA262 specification, the abstract operation ToLength returns a integer or throw completion.

Not an integer, but an integral Number. That's an important distinction: in the ES spec's terminology, an integer is a "mathematical value", but a Number is a "language value". Those are completely disjoint value spaces, though they are related via conversion operations.

However, I think that type of the return value of ToLength can be narrowed to a non-negative integer or throw completion.

If you change "integer" back to "integral Number" there, I think that narrowing would be valid.

@tmdghks
Copy link
Contributor Author

tmdghks commented Jul 24, 2024

I'm sorry for incorrectly editing the specification.
I have corrected the term integer to integral Number in the specification of the ToLength abstract operation.
Thank you for your review.

@tmdghks tmdghks changed the title Editorial: Using non-negative integer instead of integer in ToLength Editorial: Using non-negative integral Number instead of integral Number in ToLength Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants