4 ms·
This is an argument about checked indexing, not about where indexing should start; after all, whatever the index base, you still need to check that the index fi
by pwdisswordfish5 6y ago
This is an argument about checked indexing, not about where indexing should start; after all, whatever the index base, you still need to check that the index fits within the bounds of the array. It doesn’t matter if a behaviour is technically deterministic and defined if it’s not what you want to happen. I mean, just read the explanation of the ‘wat’ talk: <https://stackoverflow.com/a/9033306/3840170 https://stackoverflow.com/a/9033306/3840170>. Every one of these behaviours is defined by the ECMAScript standard, but they’re still useless.
- adrian_b 6y agoYes, but checked indexing requires only one comparison with the upper limit when your indices are 0-based, instead of 2 comparisons, when the starting index is different from 0. The sign of the index can be determined without a comparison, usually simultaneously with one of the previous operations.