<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 prefer the index() method name for this purpose, but I wonder if we might want to consider overloads for forward/backward, since not all indexes are bidirectional (or at least, not efficiently so), for example:</div><div class=""><br class=""></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>index(_ index:Index, advancedBy:Index.Distance) -&gt; Index</font></div><div class=""><font face="Monaco" class=""><span class="Apple-tab-span" style="white-space:pre">        </span>index(_ index:Index, reversedBy:Index.Distance) -&gt; Index<span class="Apple-tab-span" style="white-space:pre">        </span>// Only declared where Self.Index : BidirectionalIndexType?</font></div><div class=""><br class=""></div><div class="">But yeah, everything related to index manipulation should be doable from some variant of .index() I think.</div><br class=""><div><blockquote type="cite" class=""><div class="">On 26 Apr 2016, at 08:49, Patrick Smith via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Yes, I too find the naming confusing. I think the method should contain 'index', either in the prefix or as a parameter label, so if you searched through Collection’s methods you’d be able to find every one that was to do with indexes.<div class=""><div class=""><br class=""></div><div class="">Sorry to suggest more ideas, but here is a theoretical API with index in the prefix: (the noun is ‘index’)</div><div class=""><div class=""><br class=""></div><div class="">func index(_ index: Index, offsetBy n: IndexDistance) -&gt; Index<br class=""></div><div class="">func&nbsp;index(_ index: Index, offsetBy n: IndexDistance, limitedBy limit: Index) -&gt; Index<br class=""></div><div class=""><br class=""></div><div class="">func formIndex(_ index: inout Index, offsetBy n: IndexDistance)<br class=""></div><div class="">func formIndex(_ index: inout Index, offsetBy n: IndexDistance, limitedBy limit: Index)<br class=""></div><div class=""><br class=""></div><div class="">And here is one within a parameter: (the verb is ‘offset’)</div><div class=""><br class=""></div><div class=""><div style="line-height: 19.6px;" class="">func&nbsp;offsetted(index: Index, by n: IndexDistance) -&gt; Index<br class=""></div><div style="line-height: 19.6px;" class="">func&nbsp;offsetted(index: Index, by n: IndexDistance, limitedBy limit: Index) -&gt; Index<br class=""></div><div style="line-height: 19.6px;" class=""><br class=""></div><div style="line-height: 19.6px;" class="">func&nbsp;offset(index: inout Index, offsetBy n: IndexDistance)<br class=""></div><div style="line-height: 19.6px;" class="">func&nbsp;offset(index: inout Index, offsetBy n: IndexDistance, limitedBy limit: Index)</div></div><div style="line-height: 19.6px;" class=""><br class=""></div><div style="line-height: 19.6px;" class=""><br class=""></div><br class=""><!-- <signature> --><b class="">Patrick Smith</b><br class=""><!-- </signature> --></div></div><div class="gmail_quote">
  On Apr 26 2016, at 11:52 am, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:
  <br class="">
  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
    <div dir="ltr" class=""><div class=""><div class="">On Mon, Apr 25, 2016 at 8:25 PM, Dave Abrahams <span dir="ltr" class="">&lt;<a href="mailto:dabrahams@apple.com" target="_blank" class="">dabrahams@apple.com</a>&gt;</span> wrote:<br class=""><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class=""><span class=""><br class="">
on Mon Apr 25 2016, Xiaodi Wu &lt;<a href="http://xiaodi.wu-at-gmail.com/" rel="noreferrer" target="_blank" class="">xiaodi.wu-AT-gmail.com</a>&gt; wrote:<br class="">
<br class="">
&gt; On Mon, Apr 25, 2016 at 6:15 PM, Dave Abrahams &lt;<a href="mailto:dabrahams@apple.com" class="">dabrahams@apple.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;on Mon Apr 25 2016, Xiaodi Wu &lt;<a href="http://xiaodi.wu-at-gmail.com/" rel="noreferrer" target="_blank" class="">xiaodi.wu-AT-gmail.com</a>&gt; wrote:<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; Quick thought:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; Why are you reaching for the "form..." rule for the mutating methods when<br class="">
&gt;&nbsp; &nbsp; &nbsp;there<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; are clear verb counterparts?<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; location: locate<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; successor: succeed<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;We're not using successor(i) anymore, as noted below, and furthermore<br class="">
&gt;&nbsp; &nbsp; &nbsp;c.succeed(&amp;i) strongly implies the wrong meaning.<br class="">
&gt;<br class="">
&gt; I thought that's what I understood from the email, but in the linked proposal<br class="">
&gt; they're still there (as are the many types of Range protocols). Wrong link, or<br class="">
&gt; just not updated?<br class="">
<br class="">
</span>My mistake; I pushed to the wrong repo.&nbsp; Please try again.<br class=""></blockquote><div class=""><br class=""></div><div class="">I see a new version, but I still see .successor().</div><div class="">&nbsp;</div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="">
<span class=""><br class="">
&gt;&nbsp; &nbsp; &nbsp;I didn't consider<br class="">
&gt;&nbsp; &nbsp; &nbsp;using<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;c. locate(...:&amp;i ... )<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;primarily because I never thought of it and nobody suggested it IIRC,<br class="">
&gt;&nbsp; &nbsp; &nbsp;but I also don't see how it would work in a family with<br class="">
&gt;&nbsp; &nbsp; &nbsp;c.location(after: i) et al. Suggestions?<br class="">
&gt;<br class="">
&gt; I didn't read this proposal carefully on its initial presentation for review.<br class="">
&gt; Looking at it now, I wonder about the wisdom of "location"--I understand the<br class="">
&gt; rationale of avoiding multiple methods named "index" that do different things,<br class="">
&gt; but these particular functions return or mutate indices, and nowhere else are<br class="">
&gt; these called "locations". If you're asking for possible alternative suggestions<br class="">
&gt; to avoid using "index", I'll suggest the following here because I don't recall<br class="">
&gt; seeing them offered previously. They read as phrases or sentences:<br class="">
&gt;<br class="">
&gt; ```<br class="">
&gt; // taking inspiration from ForwardIndexType, which is no more...<br class="">
&gt; c.advancing(_ i: Index, by offset: IndexDistance, limit: Index)<br class="">
<br class="">
</span>As I've said before, the “ing” suffix strongly implies we're returning<br class="">
(a version of) `c`, not of `i`.&nbsp; c.f.<br class="">
<br class="">
&nbsp; &nbsp;Please hand me **your coat, emptying the left pocket**.<br class="">
<br class="">
You're not going to get a pocket; you're getting a whole coat.<br class=""></blockquote><div class=""><br class=""></div><div class="">Quite right; didn't mean to retread that. I feel the same deficiency applies to using the "form" convention, though, in that (at least as has been discussed on this list) the convention usually refers to the receiver being mutated. Thus, `c.formLocation(...)` sounds like `c` should be mutated in some way.</div><div class=""><br class=""></div><div class="">One way out that I can think of is looking to good ol' Objective-C conventions. By this I mean that, in my mind, shorter method names like `str.appending(...)` are derived by omitting redundant words from longer ancestral names such as `str.stringByAppendingString(...)`. In this particular case, certain words are not redundant and perhaps we should just bravely put back those words that are necessary to clarify.</div><div class=""><br class=""></div><div class="">That is, if this were Objective-C, we'd have something like "indexByAdvancingIndex". You're quite right that we can't use just "advancing" because it implies returning a version of the receiver. We've tried "index", but then it conflicts with another method "index". Now there's renaming "index" to "location", even though it returns a thing of type Index... Aren't the most succinct but still accurate method names instead: `c.indexByAdvancing(i, ...)` and `c.advanceIndex(&amp;i, ...)`? [Incidentally, `c.advance` might read like c is being advanced.]</div><div class=""><br class=""></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="">
<span class=""><br class="">
&gt; c.advance(_ i: inout Index, by offset: IndexDistance, limit: Index)<br class="">
&gt;<br class="">
&gt; // or alternatively, using the terminology in the comments that sit above<br class="">
&gt; `location`<br class="">
&gt; c.offsetting(_ i: Index, by n: IndexDistance, limit: Index)<br class="">
&gt; c.offset(_ i: inout Index, by n: IndexDistance, limit: Index)<br class="">
&gt;<br class="">
&gt; // and then, in place of successor, etc.<br class="">
&gt; c.incrementing(_ i: Index, limit: Index)<br class="">
&gt; c.increment(_ i: inout Index, limit: Index)<br class="">
&gt; c.decrementing(_ i: Index, limit: Index)<br class="">
&gt; c.decrement(_ i: inout Index, limit: Index)<br class="">
&gt; ```<br class="">
&gt; ("'Limit' doesn't read like a phrase," you might say. Well, think of a coupon:<br class="">
&gt; "$1 off one tub of margarine. Limit one per purchase. Void if transferred or<br class="">
&gt; sold.")<br class="">
<br class="">
</span>the limit label is the least of my concerns here :-)<br class=""></blockquote><div class=""><br class=""></div><div class="">That said, orthogonally, I feel like many `limitedBy` labels can be simplified to `limit` :)</div><div class="">&nbsp;</div><div class=""><br class=""></div><blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" class="">
<div class=""><div class=""><br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; On Mon, Apr 25, 2016 at 1:24 PM, Dave Abrahams via swift-evolution<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; on Wed Apr 20 2016, Chris Lattner &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; On Apr 10, 2016, at 2:41 PM, Chris Lattner<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; &lt;<a href="mailto:clattner@apple.com" class="">clattner@apple.com</a>&gt; wrote:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; Hello Swift community,<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; The review of "A New Model for Collections and Indices" begins now and<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; runs<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; through April 18th. The proposal is available here:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md</a><br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; Reviews are an important part of the Swift evolution process. All<br class="">
&gt;&nbsp; &nbsp; &nbsp;reviews<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; should be sent to the swift-evolution mailing list at:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; or, if you would like to keep your feedback private, directly to the<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; review<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; manager.<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; A quick update: the core team met to discuss this. They agreed to accept<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; it with<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; some naming-related revisions to the proposal (in response to community<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; feedback). Dave is organizing this feedback, and I’ll send out the<br class="">
&gt;&nbsp; &nbsp; &nbsp;formal<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt; announcement when that is ready.<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; The final revisions are reflected in the latest version of the<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; proposal:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md</a><br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; Summary:<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; * We decided to take Shawn Erickson's excellent suggestion<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &lt;<a href="http://article.gmane.org/gmane.comp.lang.swift.evolution/14450" rel="noreferrer" target="_blank" class="">http://article.gmane.org/gmane.comp.lang.swift.evolution/14450</a>&gt; to<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; use “location” uniformly for index movement, so instead of<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; successor(i) and predecessor(i) we have location(after: i) and<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; location(before: i).<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; * Since Brent Royal-Gordon pointed out<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&lt;<a href="http://news.gmane.org/find-root.php?message_id=156D8FB1%2d1FD3%2d448E%2d8C70%2d6E7400629BC0%40architechies.com" rel="noreferrer" target="_blank" class="">http://news.gmane.org/find-root.php?message_id=156D8FB1%2d1FD3%2d448E%2d8C70%2d6E7400629BC0%40architechies.com</a><br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; that two of the three proposed Range protocols would likely disappear<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; in future updates, we took another look at all of them. Finding<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; `RangeProtocol` itself to be a very weak abstraction, we removed all<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; three from the proposal.<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; For those interested in details, implementation work proceeds apace on<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; the swift-3-indexing-model branch at<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&lt;<a href="https://github.com/apple/swift/tree/swift-3-indexing-model/stdlib/public/core" rel="noreferrer" target="_blank" class="">https://github.com/apple/swift/tree/swift-3-indexing-model/stdlib/public/core</a><br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; &gt;.<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; P.S. If anyone is interested in contributing, there are still plenty of<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; FIXMEs left for us to handle ;-)<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; --<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; Dave<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; _______________________________________________<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; swift-evolution mailing list<br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; <a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt; <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
&gt;&nbsp; &nbsp; &nbsp;&gt;<br class="">
&gt;<br class="">
&gt;&nbsp; &nbsp; &nbsp;--<br class="">
&gt;&nbsp; &nbsp; &nbsp;Dave<br class="">
&gt;<br class="">
<br class="">
</div></div><span class="">--<br class="">
Dave<br class="">
</span></blockquote></div><br class=""></div></div>
  </blockquote>
</div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></body></html>