| 22:34 | <ljharb> | it seems weird to me that SetTypedArrayFromArrayLike allows targetOffset to be a non-neg int, or ∞, but then it throws a RangeError if it's ∞ in step 11. why not throw that sooner, or disallow it entirely? |
| 23:40 | <shu> | i'd guess because that's just how it was copy/pasted during refactoring |
| 23:41 | <shu> | i can see an argument for helper AOs having tighter, already-checked types |
| 23:41 | <shu> | file an issue? |
| 23:51 | <jmdyck> | %TypedArray%.prototype.set has Let _targetOffset_ be ? ToIntegerOrInfinity(...), so SetTypedArrayFromTypedArray and SetTypedArrayFromArrayLike have to accept infinity for that param. Both of them end up throwing a RangeError on infinity, BUT only if they haven't thrown for some other reason before then. So it's tempting to throw on infinity way up in %TypedArray%.prototype.set, but that would be a change in behaviour for some (pathological) cases. |
| 23:59 | <jmdyck> | Looks like throw-on-infinity was added in PR #2007, to avoid doing arithmetic on infinity, that previously would have been implicit in the subsequent step. |