> On Jul 25, 2016, at 11:32 PM, David Hart via swift-evolution > <swift-evolution@swift.org> wrote: > > > > On 26 Jul 2016, at 06:50, Xiaodi Wu via swift-evolution > <swift-evolution@swift.org <mailto:swift-evolution@swift.org>> wrote: > >> surface area and leverages the user's understanding of how ranges >> work. >> >> It also implies we can replace >> >> x.removingPrefix(n) >> x.removingSuffix(n) >> >> with >> >> x[$+n..<] >> x[..<$-n] >> >> for Collections. >> >> I'm not enamored of this suggestion. It succeeds in reducing API surface >> area, but at a severe cost to readability. You'd replace an unambiguous >> phrase (removing prefix or suffix), the meaning of which is further >> clarified by the consistent usage proposed in SE-0132, with a wordless >> spelling using some combination of [$+.<]. Cognitively, also, it >> substantially increases the burden for the reader: it replaces a single >> argument with a nested series of arguments; first, one must understand the >> meaning of the $ placeholder, then one must consider an addition or >> subtraction operation, then the formation of a range, and in the last >> example, the use of that range as a subscript argument--again, all >> wordlessly. Finally, subscripts have so far not been "forgiving," while >> today's `dropLast` very much is; this suggestion would add inconsistency by >> using a subscript for a forgiving or "lenient" operation. > > I second Xiaodi. I am against the slicing subscripts and the ones above look > even more unreadable and inscrutable than those in the proposal. I don't > understand the rational.
The inspiration is D: https://dlang.org/d-array-article.html <https://dlang.org/d-array-article.html> > _______________________________________________ > swift-evolution mailing list > swift-evolution@swift.org > https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution