Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRedundancy in the `ToLength`? #721
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Oct 27, 2016
Member
I think this is a case where the redundancy does no harm and is actually helpful to readers of the spec.
Readers look at the ToX abstract operations when they need verify, for themselves, how specific cases are handled. In such situations it is easier to see an explicit statement of how +Infinity is handled than to have to remember or lookup that max() is defined to work with +Infinity.
|
I think this is a case where the redundancy does no harm and is actually helpful to readers of the spec. Readers look at the ToX abstract operations when they need verify, for themselves, how specific cases are handled. In such situations it is easier to see an explicit statement of how |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
leobalter
Oct 27, 2016
Member
This step was an useful reference when I wrote tests for TypedArrays, I imagined the same applies to runtime implementors. That's a case when clarity wins brevity.
|
This step was an useful reference when I wrote tests for TypedArrays, I imagined the same applies to runtime implementors. That's a case when clarity wins brevity. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zerkms
Oct 27, 2016
@allenwb @leobalter then for consistency it should be another step that checks for -Infinity.
If len is -Infinity return +0
zerkms
commented
Oct 27, 2016
•
|
@allenwb @leobalter then for consistency it should be another step that checks for
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
chozzz
commented
Oct 28, 2016
|
@zerkms They already did that on step 2.
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
zerkms
Oct 28, 2016
@chozzz sure.
That's my exact point: if it is fine to expect -Infinity less than zero, then it would be equally fine to expect +Infinity greater than 2^53-1.
zerkms
commented
Oct 28, 2016
•
|
@chozzz sure. That's my exact point: if it is fine to expect |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Editorially I am fine with the current spec text in this regard. |
bterlson
closed this
Nov 14, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Nov 23, 2016
Member
There is now evidence of three people being confused by this. Since the min part is fairly straight forward I guess we'll remove the redundant check and rely on implementers to understand how max/min work with +/-Infinity.
|
There is now evidence of three people being confused by this. Since the min part is fairly straight forward I guess we'll remove the redundant check and rely on implementers to understand how max/min work with +/-Infinity. |
zerkms commentedOct 27, 2016
•
edited
http://www.ecma-international.org/ecma-262/7.0/#sec-tolength
The step 3 there is an explicit comparison with the
+Infinity.What is the point to have it there, as long as it will be handled by the last step
Return min(len, 2^53-1).anyway.