[Draft] Adding Safe indexing to Array

Some will reply that a[i] is already checked, and that a[checked: i] is redundant.

"Lenient" is hard to read for non-native English speakers that have a limited vocabulary (and code readability is important).

a[safe: i] matches what's is everyone's mind (avoid crash), but does not match "safe" as Swift likes to define it (comply to preconditions or crash).

It could live with short and purely made-up subscripts, like a[at: i], or a[index: i]. We'd all get used to them, since it's quite a frequent use case.

1 Like