On 07/20/2016 06:18 PM, Mike Parker wrote:
The relevant lines I quoted from the docs above explain quite clearly that it's because they are multi-byte formats. Indexing them is not inefficient, it simply makes no sense. What does it mean to take the value at index i when it is part of a multi-byte sequence that continues at index i+1? Auto-decoding has nothing to do with it.
Without auto decoding, char[] would (most probably) be a random access range of code units. Taking the value at index i would return the code unit at index i, like it does for the array.
It's not that way, because narrow strings are decoded by the range primitives (auto decoding).