<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Apr 25, 2016 at 8:25 PM, Dave Abrahams <span dir="ltr"><<a href="mailto:dabrahams@apple.com" target="_blank">dabrahams@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br>
on Mon Apr 25 2016, Xiaodi Wu <<a href="http://xiaodi.wu-AT-gmail.com" rel="noreferrer" target="_blank">xiaodi.wu-AT-gmail.com</a>> wrote:<br>
<br>
> On Mon, Apr 25, 2016 at 6:15 PM, Dave Abrahams <<a href="mailto:dabrahams@apple.com">dabrahams@apple.com</a>> wrote:<br>
><br>
> on Mon Apr 25 2016, Xiaodi Wu <<a href="http://xiaodi.wu-AT-gmail.com" rel="noreferrer" target="_blank">xiaodi.wu-AT-gmail.com</a>> wrote:<br>
><br>
> > Quick thought:<br>
> ><br>
> > Why are you reaching for the "form..." rule for the mutating methods when<br>
> there<br>
> > are clear verb counterparts?<br>
> > location: locate<br>
> > successor: succeed<br>
><br>
> We're not using successor(i) anymore, as noted below, and furthermore<br>
> c.succeed(&i) strongly implies the wrong meaning.<br>
><br>
> I thought that's what I understood from the email, but in the linked proposal<br>
> they're still there (as are the many types of Range protocols). Wrong link, or<br>
> just not updated?<br>
<br>
</span>My mistake; I pushed to the wrong repo. Please try again.<br></blockquote><div><br></div><div>I see a new version, but I still see .successor().</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> I didn't consider<br>
> using<br>
><br>
> c. locate(...:&i ... )<br>
><br>
> primarily because I never thought of it and nobody suggested it IIRC,<br>
> but I also don't see how it would work in a family with<br>
> c.location(after: i) et al. Suggestions?<br>
><br>
> I didn't read this proposal carefully on its initial presentation for review.<br>
> Looking at it now, I wonder about the wisdom of "location"--I understand the<br>
> rationale of avoiding multiple methods named "index" that do different things,<br>
> but these particular functions return or mutate indices, and nowhere else are<br>
> these called "locations". If you're asking for possible alternative suggestions<br>
> to avoid using "index", I'll suggest the following here because I don't recall<br>
> seeing them offered previously. They read as phrases or sentences:<br>
><br>
> ```<br>
> // taking inspiration from ForwardIndexType, which is no more...<br>
> c.advancing(_ i: Index, by offset: IndexDistance, limit: Index)<br>
<br>
</span>As I've said before, the “ing” suffix strongly implies we're returning<br>
(a version of) `c`, not of `i`. c.f.<br>
<br>
Please hand me **your coat, emptying the left pocket**.<br>
<br>
You're not going to get a pocket; you're getting a whole coat.<br></blockquote><div><br></div><div>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><br></div><div>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><br></div><div>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(&i, ...)`? [Incidentally, `c.advance` might read like c is being advanced.]</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
> c.advance(_ i: inout Index, by offset: IndexDistance, limit: Index)<br>
><br>
> // or alternatively, using the terminology in the comments that sit above<br>
> `location`<br>
> c.offsetting(_ i: Index, by n: IndexDistance, limit: Index)<br>
> c.offset(_ i: inout Index, by n: IndexDistance, limit: Index)<br>
><br>
> // and then, in place of successor, etc.<br>
> c.incrementing(_ i: Index, limit: Index)<br>
> c.increment(_ i: inout Index, limit: Index)<br>
> c.decrementing(_ i: Index, limit: Index)<br>
> c.decrement(_ i: inout Index, limit: Index)<br>
> ```<br>
> ("'Limit' doesn't read like a phrase," you might say. Well, think of a coupon:<br>
> "$1 off one tub of margarine. Limit one per purchase. Void if transferred or<br>
> sold.")<br>
<br>
</span>the limit label is the least of my concerns here :-)<br></blockquote><div><br></div><div>That said, orthogonally, I feel like many `limitedBy` labels can be simplified to `limit` :)</div><div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
> > On Mon, Apr 25, 2016 at 1:24 PM, Dave Abrahams via swift-evolution<br>
> > <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
> ><br>
> > on Wed Apr 20 2016, Chris Lattner <<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a>> wrote:<br>
> ><br>
> > > On Apr 10, 2016, at 2:41 PM, Chris Lattner<br>
> > > <<a href="mailto:clattner@apple.com">clattner@apple.com</a>> wrote:<br>
> > ><br>
> > > Hello Swift community,<br>
> > ><br>
> > > The review of "A New Model for Collections and Indices" begins now and<br>
> > runs<br>
> > > through April 18th. The proposal is available here:<br>
> > ><br>
> > ><br>
> ><br>
> <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md" rel="noreferrer" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md</a><br>
><br>
> ><br>
> > ><br>
> > > Reviews are an important part of the Swift evolution process. All<br>
> reviews<br>
> > > should be sent to the swift-evolution mailing list at:<br>
> > > <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
> > > or, if you would like to keep your feedback private, directly to the<br>
> > review<br>
> > > manager.<br>
> > ><br>
> > > A quick update: the core team met to discuss this. They agreed to accept<br>
> > it with<br>
> > > some naming-related revisions to the proposal (in response to community<br>
> > > feedback). Dave is organizing this feedback, and I’ll send out the<br>
> formal<br>
> > > announcement when that is ready.<br>
> ><br>
> > The final revisions are reflected in the latest version of the<br>
> > proposal:<br>
> ><br>
> ><br>
> <a href="https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md" rel="noreferrer" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0065-collections-move-indices.md</a><br>
><br>
> ><br>
> > Summary:<br>
> ><br>
> > * We decided to take Shawn Erickson's excellent suggestion<br>
> > <<a href="http://article.gmane.org/gmane.comp.lang.swift.evolution/14450" rel="noreferrer" target="_blank">http://article.gmane.org/gmane.comp.lang.swift.evolution/14450</a>> to<br>
> > use “location” uniformly for index movement, so instead of<br>
> > successor(i) and predecessor(i) we have location(after: i) and<br>
> > location(before: i).<br>
> ><br>
> > * Since Brent Royal-Gordon pointed out<br>
> ><br>
> <<a href="http://news.gmane.org/find-root.php?message_id=156D8FB1%2d1FD3%2d448E%2d8C70%2d6E7400629BC0%40architechies.com" rel="noreferrer" target="_blank">http://news.gmane.org/find-root.php?message_id=156D8FB1%2d1FD3%2d448E%2d8C70%2d6E7400629BC0%40architechies.com</a><br>
><br>
> > ><br>
> > that two of the three proposed Range protocols would likely disappear<br>
> > in future updates, we took another look at all of them. Finding<br>
> > `RangeProtocol` itself to be a very weak abstraction, we removed all<br>
> > three from the proposal.<br>
> ><br>
> > For those interested in details, implementation work proceeds apace on<br>
> > the swift-3-indexing-model branch at<br>
> ><br>
> <<a href="https://github.com/apple/swift/tree/swift-3-indexing-model/stdlib/public/core" rel="noreferrer" target="_blank">https://github.com/apple/swift/tree/swift-3-indexing-model/stdlib/public/core</a><br>
><br>
> > >.<br>
> ><br>
> > P.S. If anyone is interested in contributing, there are still plenty of<br>
> > FIXMEs left for us to handle ;-)<br>
> ><br>
> > --<br>
> > Dave<br>
> ><br>
> > _______________________________________________<br>
> > swift-evolution mailing list<br>
> > <a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
> > <a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
> ><br>
><br>
> --<br>
> Dave<br>
><br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Dave<br>
</font></span></blockquote></div><br></div></div>