<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I actually think we should use ‘mapped’, ‘filtered’, and ‘reduced’ instead of the “Terms of Art”. They start with the same words, so anyone looking for ‘map’, ‘filter’, and ‘reduce’ will see them in the autocomplete.</div><div class=""><br class=""></div><div class="">The signatures are also different, so:</div><div class=""><br class=""></div><div class="">let newList = list.map(…)</div><div class=""><br class=""></div><div class="">would throw an error because I have the signature wrong. Given the consistent naming rules, ‘mapped’ will be tried fairly quickly (especially with auto-complete). If we are extra worried, we could put in a diagnostic/fixit to teach the ‘mapped’, etc… version.</div><div class=""><br class=""></div><div class="">Seems like needless (and confusing) inconsistency otherwise...</div><div class=""><br class=""></div><div class="">Thanks,</div><div class="">Jon</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><pre style="white-space: pre-wrap; background-color: rgb(255, 255, 255);" class="">><i class=""> What is the rationale behind the name dropFirst()? Being a non-mutating method it should clearly be e.g. droppingFirst() according to the API Naming Guidelines.
</i>
Like many `Sequence` and `Collection` operations, `dropFirst()` is a result of the "term of art" exception, which is implied by the "Use Terminology Well" section of the API Guidelines: <<a href="https://swift.org/documentation/api-design-guidelines/#use-terminology-well" class="">https://swift.org/documentation/api-design-guidelines/#use-terminology-well</a>>
Many languages use `dropWhatever` or `drop_whatever` for operations which return some sort of list with some of its leading or trailing elements removed. For instance:
* Ruby (which I happen to have in Dash) has `drop(n)` and `drop_while` methods.
* Haskell has `drop n`, `dropWhile`, and `dropWhileEnd` functions.
* Scala has a `drop(n)` method.
* R has a `dropFirst` function.
The standard library has chosen to break its usual patterns in order to maintain consistency with languages like these.
Personally, I believe the term of art exception has been misapplied in this area of the language; the precedents are not very strong, and the resulting APIs form a patchwork of inconsistent names rather than a coherent family. The term of art exception increases the clarity of calls like `map` and `filter` where the names are truly universal, but it impedes the clarity of the whole family of `first`/`prefix`/`suffix`/`last` calls, and the names should be revisited and rationalized. But that hasn't happened yet.</pre></blockquote><div class=""><br class=""></div></div></body></html>