> On 08 Apr 2016, at 13:19, Haravikk via swift-evolution
> <swift-evolution@swift.org> 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.
In addition:
> If we want mutating forms of this methods then I much prefer .map() and
> .mapped() to .map() and .mapInPlace() or whatever, as the latter contradicts
> the naming convention used everywhere else which only adds confusion.
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.
— Pyry
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution