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

Haravikk swift-evolution at haravikk.me
Tue Apr 19 13:04:53 CDT 2016

> On 19 Apr 2016, at 17:19, Brent Royal-Gordon <brent at architechies.com> wrote:
>>> I wrote my first Python this week. I was very glad that `map` was named `map`. I just had to glance at the docs to see whether it was a function or a method and which argument came first. It took less time and involved less doubt than learning their closure syntax did.
>> Are you suggesting that if it had been named “mapped” or “mapping” that you would have been unable to find it? Any decent search engine and/or auto-complete should get you to the correct function just as quickly, again, I don’t think anyone is suggesting that these functions be radically renamed, just that their tense be altered to match the new naming convention, which doesn’t change the root word from which they are derived.
> I'm suggesting that if it had been named `mapped` or (especially) `mapping`, I would have been a lot less certain I was looking at the list function and not a type or method that was unrelated to the traditional `map`. I probably would have still found it, but I wouldn't have been immediately sure it was right.

If we’re assuming you’re totally new to Swift and the first thing you do is go looking for a map function, then you’d still need to double check exactly what you’re doing anyway (how to write the closure etc.) so I’m not sure a few extra letters is going to make a meaningful difference in speed as you’ll be double checking documentation anyway to be sure you use the function correctly.

Meanwhile if you’ve been through a few Swift tutorials or whatever with the current API guidelines adhered to, then you should be used to, or at least aware of, the form for mutating vs non-mutating method names, so seeing mapped shouldn't cause much pause either.

I just don’t think it can possibly have a meaningful impact on time; it’s not as if developers are going to be off wandering the streets with their whole world turned upside-down, unable to figure out what to do with themselves because they’re suddenly unable to find a map method, only some bewildering, alien method named “mapped” that could be anything.

I’ll grant that switching to mapped is relatively minor, but if everything else is named following one set of rules I think a better case needs to be made for why some functions should have their own set of rules, especially if it amounts to “that’s what others call it”, in particular if those others call it that because that’s what others call it and so-on ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160419/b867d603/attachment.html>

More information about the swift-evolution mailing list