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

David Rönnqvist david.ronnqvist at gmail.com
Mon Jul 25 16:09:37 CDT 2016


>    * What is your evaluation of the proposal?

-1. I think that there might be something to this idea, but am against the proposal in its current form for the same reasons that have already been stated: flatten has a broader use than just joining sequences/collections, and flatten as a name is strongly related to flatMap.

Not merging "flatten" and "joined" but still adding the default arguments would make the similarities between the two even more confusing. 

The name of the merged function (if any) needs more consideration, taking into account it's broader context and future use.

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

Not sure.

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

No. In its current form it's almost an oversimplification.

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

Haskell calls the general m (m a) -> m a function for "join", but also has a specialized [[a]] -> [a] function called "concat". (The function corresponding to "flatMap" is called "bind" in Haskell (although used as an operator), so since neither is called flatten or flatMap it doesn't have the confusion where one of them would be named so).

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

Read the proposal.  

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160725/f4dcd2f5/attachment.html>


More information about the swift-evolution mailing list