[SR-8883] ArraySlice/Data subscript behavior is not intuitive and dangerous #51389
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Swift 4.2
Additional Detail from JIRA
md5: 4302353e56be343f06108cc521c4ca83
relates to:
Issue Description:
I've ran into so many `EXC_BAD_INSTRUCTION` crashes because I constantly forget how unnatural slice ranges are in Swift. When I create a slice, I actually expect a window into the array starting with index 0 again, like golang.org does it. This feels natural and intuitive. It makes absolutely no sense to retain index numbers from an array that has nothing to do with the current view of the data, so to actually get the "correct" behaviour you have to wrap it again and convert the slice back.
The text was updated successfully, but these errors were encountered: