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

Haravikk swift-evolution at haravikk.me
Mon Apr 11 04:48:37 CDT 2016


> On 10 Apr 2016, at 22:11, Brent Royal-Gordon <brent at architechies.com> wrote:
> 
> Do you also think that trigonometry should be `foo.sined`, `foo.cosined`, and `foo.tangented`?

sine, cosine etc. are all nouns so I think as computed properties they’d be fine as is?

> If there is a universally-accepted nomenclature for a particular operation, the clearest thing we can do is to adopt it, even if it doesn't match our normal guidelines.

It still makes me uncomfortable to accept something purely because it is “universal”, as I’d wager that most languages with these terms have chosen them for the same reason, i.e- they're common because they're common, rather than because they’re necessarily the best terms for each language. It’s like a self-fulfilling prophecy; if Swift accepts them because they’re common, then it continues to make them common; as long as that trend continues they’ll never cease to be common.

I know it’s pretty minor in the scheme of things, but I don’t see that we lose anything by naming them consistently.

flatMap is certainly a pain in the ass in this case, but perhaps there’s a better alternative that isn’t comprised of two other method names? i.e- what is it most commonly used to actually achieve, perhaps there’s a more suitable term from that? It’s not a method I’ve ever actually found myself using, as the only cases I’ve come close I’ve always had some kind of hiccup that prevent me from taking advantage of it, so had to use something more complex instead.


More information about the swift-evolution mailing list