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

Vladimir.S svabox at gmail.com
Thu Apr 21 02:08:09 CDT 2016


On 20.04.2016 20:47, Dave Abrahams wrote:
>
> 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.

Oh, thank you for clarifying this.

>
>> 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.
>

Well..
arr.sort() - mutating method. verb.
arr.sorted() - non-mutating. "..ed"
and..
arr.filter() - non-mutating. verb. I think a user who read API Design 
Guidelines can expect arr.filter() will be a mutating method.


>> 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.

Is it "SE-0006" ?
https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md

Could you please point me to lines in this document where it says that 
"map/filter/reduce" are exceptions and we don't need to rename them to 
mapped/filtered/reduced ? Thank you.

>
>> 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.
>


More information about the swift-evolution mailing list