SE-0231 — Optional iteration

What is your evaluation of the proposal?

+0.5, for both bike shedding and importance reasons.

First, I wonder if another syntax would be more consistent with the language, for instance:

for person in let people = people { ... }

might be more consistent with the rest of the language.

Second, I wonder if this is really needed enough to complicate the grammar at all.

Is the problem being addressed significant enough to warrant a change to Swift?

To be honest, I don't think so.

I haven't run into this case, as I typically avoid optional except when needed. I don't have much data where an empty sequence and a missing sequence would have different meanings, so by the time I try to process data it would have some other mechanism to either skip processing the sequence, or have been converted to an empty sequence.

If a missing and empty sequence mean two different things, then people will generally be using optionality for a distinct processing path. If not - why bother have a missing sequence in your data model at all?

Does this proposal fit well with the feel and direction of Swift?

I would imagine in terms of simplifying control flow (focusing on the business logic than complex, nested conditional logic)

If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

None

How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Argued in the original thread :slight_smile:

2 Likes