4 ms·
Which leads to the question why you would use offset / index syntax instead of dot syntax in the first place. Therefore I would prefer something like this to b
by still_grokking 4y ago
Which leads to the question why you would use offset / index syntax instead of dot syntax in the first place.
Therefore I would prefer something like this to be the usual array access syntax:
val chars = Array("a", "b", "c")
val secondChar = a.2 // as a shorthand for `chars.atIndex(2)`, or equivalently `chars.atOffset(1)`, maybe also with `a..1` for the offset case
(Also we should stop calling the offset "index", and get a proper "atIndex" method.)