> On 7 Apr 2016, at 19:12, Dave Abrahams via swift-evolution 
> <[email protected]> wrote:
> 
> We kept flatten as is because it is part of a suite of methods that are terms 
> of art from functional programming (map, filter, flatMap, reduce) that don't 
> follow the naming guidelines

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.

For users coming to Swift as a first language I think that consistent naming is 
more important, and while terms of art are useful, it’s not as if changing the 
tense is changing the meaning or making them hard to find; anyone that types 
myArray.map… will have Xcode present them with .mapped. 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.

Besides, I’d say the terms of art in these cases are more about what the basic 
operation does, whether or not the method manipulates the original is something 
that a developer should really check, i.e- when I look for .map in a new 
language I’m looking for a transformation method, I’ll then check what exactly 
that transformation does to the original collection. Plus features like unused 
result and type checks should keep people right about wether they’re using it 
correctly, so any mistake should be caught pretty easily.
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to