> On 8 Apr 2016, at 12:00, Pyry Jahkola <[email protected]> wrote:
> 
> 
>> On 08 Apr 2016, at 13:19, Haravikk via swift-evolution 
>> <[email protected] <mailto:[email protected]>> wrote:
>> 
>> I think it makes sense to just rename them; it’s not as though flattened or 
>> mapped is somehow far removed from the original meaning as the actual action 
>> is the same, it’s just changing tense.
> 
> -1, and not only for the reasons we neither call trigonometric functions 
> `sine`, `cosine`, and `tangent`. The existing names are widely known, 
> commonly taught in modern introductory programming courses, to the point, and 
> googleable.

I’m not sure if sine, cosine etc. are equivalent to the case of map, flatten 
and so-on? Are they not nouns rather than verbs?
I don’t think googleable should be that important; what’s important is what the 
method does, i.e- what you want to do, as long as it’s well described it should 
still be searchable, especially if there is a mutating equivalent that’s named 
in present tense.

> This idea of in-place versions is innocuous but absurd. In general, there's 
> no way mapping `T -> U` over a `[T]` could possibly accommodate the result in 
> the argument of type `[T]`:
> 
>     var xs: [Int] = ...
>     xs.mapInPlace {String($0)} // ???
> 
> And the same goes for `flatMap`, and `Optional` and others. Likewise, 
> `flatten()` couldn't possibly happen in place because the result type has one 
> level of nesting less than the argument.

True enough, didn’t think that through, though mapping where the type remains 
unchanged would be possible. Not really the point though, I think it should 
still be named consistently; if you make exceptions then why have guidelines on 
naming at all?
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to