[swift-evolution] [SR-933] Rename flatten to flattened

Dave Abrahams dabrahams at apple.com
Wed Apr 20 12:47:14 CDT 2016


on Tue Apr 19 2016, "Vladimir.S" <svabox-AT-gmail.com> wrote:

> Dave, could you clarify your message with more details please.
> Are you saying that "map" will be "map" in Swift 3.0 

That is the current plan of record.

> and that "flatten" is the same kind of special case when we don't need
> to rename it?

Yes, “flatten” is in the same category because of its very close
semantic relationship to “map” and “flatMap.”

If it were not in this category I would want to rename it to
“flattenOneLevel” or “concatenateElements” or something, as I have
always felt the name “flatten” was insufficiently specific about its
semantics.  But it is, like “map,” “flatMap,” and “reduce,” a term of
art that many people would not recognize if we renamed it.

> Just checked. Don't understand. In Swift 3.0 (mar 24) there are "map"
> "filter" "reduce", not "mapped" etc as I though. IMO all this renaming
> is becoming more and more strange. IMO We'll have inconsistent
> language at the end. Or this is just old version of Swift 3.0 and
> newer have "mapped" etc ? Confused.
>
> Now in 3.0(mar 24), we have arr.sorted() but arr.map (not .mapped())
> arr.filter (! I expect a mutating filtering of the arr itself
> according to API Design Guidelines) etc.

I don't understand what you say you expect.

> OK.. Could someone point to where "we" decided that map/filter/reduce
> (and probably others) will not be renamed according Guidelines or
> clarify the situation with renaming of map/filter/reduce ? Thank you.

“We” decided it when the changes to the standard library to make it
conform to the API guidelines were put up for review and the changes
were accepted.  In those changes, map/filter/reduce/flatMap/flatten all
retained their names.

> On 20.04.2016 2:00, Dave Abrahams via swift-evolution wrote:
>> Cases like this are exactly why the API guidelines have a “Use
>> terminology well” section.  “map” is provided for by that section.

-- 
Dave


More information about the swift-evolution mailing list