[swift-evolution] [SHORT Review] SE-0133: Rename `flatten()` to `joined()`

Brent Royal-Gordon brent at architechies.com
Tue Jul 26 08:26:54 CDT 2016

> On Jul 25, 2016, at 1:11 PM, Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
> I'm giving the overall idea a +0 and the specific proposal as currently
> written a -1, because I think this is a much more complicated bikeshed
> than it appears to be on the surface and the proposal doesn't begin to
> address the issues.  Specifically, I'm concerned about these points:
> * `flatten` works on Optional<Optional<T>> and sequences of Optional<T>.
>  How does it make sense to rename these operations “join?”
> * The name and semantics of `flatten` is linked to that of `flatMap`.
>  It's almost impossible to explain what `flatMap` does without
>  reference to `flatten`.  Will it make sense to explain `flatMap` in
>  terms of `joined`?
> * `flatten` is a functional term of art in the same family as `flatMap`.
>  We have good reasons to consider changing some of the other names in
>  this family, such as `filter` and `reduce`, but that idea has met with
>  significant resistance on the list.  How far should we go?  Does it
>  make sense to make this one change alone?
> I could be convinced to change my evaluation of the proposal if there
> are good answers to these questions, but until then, I'm not won over.

I'm basically in agreement with Dave here. This is worth a lot more thought than we have time to put in right now, and the cost of waiting is a deprecation cycle on n+1 methods instead of n methods. Let's defer until 3.1 and have a proper think about it with a wider scope than just `flatten()`.

Brent Royal-Gordon

More information about the swift-evolution mailing list