SE-0207: Add a containsOnly algorithm to Sequence

What is your evaluation of the proposal?

I like the feature.

I really don't like the name. In particular, one helper method that I often find myself wanting is "does this collection contain exactly one match for predicate". It is possible to read containsOnly as that method (in fact, I was excited to see the proposal because at first I thought that is what it would be). After thought, I agree Only does match the use here, but I think it is subtle enough that it makes me rather unhappy with the naming.

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

Yes, it is a useful function.

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

Sure, if an acceptable name is found.

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

No strong opinion, it is hard to reconcile naming in other languages with Swift's naming conventions.

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

A quick reading.

2 Likes