Re:Microfeatures I'd like to see in more languages
by edflsafoiewq on Thursday January 05, 2023 @08:53PM
(#34269931)
If you intended to calculate an index and you accidentally get len(arr), you get a runtime error. But if you accidentally get -1 you silently get the last element instead. Similar to the argument about signed/unsigned indices in low level languages.
[ Parent
| on HN ]
Re:Microfeatures I'd like to see in more languages
by ilyt on Thursday January 05, 2023 @09:29PM
(#34270197)
If you calculated wrong you can land on positive-but-existing value just fine...
> Similar to the argument about signed/unsigned indices in low level languages.
Think that one has to do more with convenience where most of stuff uses int by default