<div id="compose" contenteditable="true" aria-label="Message body" style="padding-left: 16px; padding-right: 16px; padding-bottom: 8px;"><b>On keeping map() as map() but keeping the -ed and -ing guideline for other APIs:</b></div><div class="gmail_quote"><div><br></div>What defines prior art really? I’m fairly new to functional programming, but I imagine there is a plethora of other API designs that can be copied. In Swift, do they all take on the past-particle naming? <div><br></div><div>Which consistency is more important, consistency with other popular libraries, or with the Swift naming guidelines recommending -ed and -ing?</div><div><div><br></div><div>What happens if new API designs are created from here on, are they considered to be prior art or not?</div><div><br></div><div><b>On why is there a need for -ed and -ing in the first place?:</b></div><div><br></div><div>Naming is called one of the hardest things in computer science for a reason. Swift is meant to make programming easier, so why doesn’t it make naming easier? Just keep things simple. Who cares if it’s not proper english (you will never achieve perfect sentences), as the APIs are far superior in readability and comprehension than either strcat() or stringByAppendingString()<span style="line-height: 1.4;"> of old.</span></div><div><br></div><div>Objective-C was derided for its overly verbose naming, and now Swift wants to introduce a new quirk to again set it apart from other languages?<br></div><div><br></div><div><b>A divide in naming</b></div><div><br></div><div>In functional programming, the emphasis is on what is returned. <i>filter</i> returns an affected copy.</div><div><br></div><div>In object oriented programming, the emphasis is usually the target. <i>NSMutableArray.removeLastObject()</i> affects the receiver, and returns nothing.</div><div><br></div><div>They are both verbs in present tense, yet behave differently.</div><div><br></div><div>We have two worlds coming together in Swift, and somehow they have to meet up. So I see why the -ed and -ing rule was created, especially as it suits the Cocoa framework well with the newly shortened API naming. But still, I think it’s somewhat messy (and potentially unfortunate as Cocoa and its dependence on reference types will one day be the past).</div><div><br></div><div>The guidelines affect both functional and object-oriented approaches (the Swift standard library includes pieces of both), and they affect both value and reference types. They are broad rules for a varied landscape.</div><div><br></div><b>Patrick Smith</b><br></div><div class="gmail_quote"> On Apr 19 2016, at 7:56 pm, Haravikk via swift-evolution <<a dir="ltr" href="mailto:swift-evolution@swift.org" x-apple-data-detectors="true" x-apple-data-detectors-type="link" x-apple-data-detectors-result="2">swift-evolution@swift.org</a>> wrote: <br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <meta content="text/html charset=utf-8"><div><br></div><div><blockquote><div>On 19 Apr 2016, at 10:40, Brent Royal-Gordon via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:</div><br><div><blockquote>Totally agree with Brent, too. And I wouldn't rename flatten either.<br></blockquote><br>A brief postscript on terms of art:<br><br>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.</div></blockquote><br></div><div>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.</div><div><br></div><div><blockquote><div>On 15 Apr 2016, at 12:49, Daniel Steinberg via swift-evolution <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:</div><br><div>I agree with this and add that the 2.2 naming is unambiguous. There’s no doubt what is meant by sortInPlace().<br></div></blockquote></div><br><div>I’m normally in favour of more explicit meaning rather than less, but this where Swift’s type system and the @warn_unused_result attribute come into play to eliminate the need for it:</div><div><br></div><div><span style="white-space:pre">        </span>myCollection.sorted()<span style="white-space:pre">                        </span>// Warning, unused result</div><div><span style="white-space:pre">        </span>let sorted = myCollectioned.sort()<span style="white-space:pre">        </span>// Void return type</div><div><br></div><div>A more explicit term is only needed for functions where there is ambiguity in how they are used IMO, i.e- if a function is both mutating and has a return type. The fact that .sort() doesn’t return anything does a pretty good job of clarifying what it does.</div> </blockquote></div><br><br></div>