Closed michaelficarra closed 9 months ago
Even have a.setAt(i, v)
, the ergonomics still can't compare to a[^i]
in many cases, for example:
a[^index]++
vs a.setAt(-index, a.at(-index) + 1)
And negative index also have the flaws of -0 edge cases and easy to misuse in the case like let i = a.findIndex(test); a.at(i)
(i
might be -1)
I also presented other reasons why a[^i]
is better, you could even check my first time presentation (at that time, at()
still not stage 4, so have more details comparison and why at()
is not a good thing IMO)
Consider this issue as solved. Feel free to reopen if need any further discussion.
You say that this is motivated even in the presence of
.at(relativeIndex)
because it is also allowed in assignment position. Can't asetAt(relativeIndex, value)
also be a solution to this problem?