[swift-evolution] Feature proposal: Range operator with step
dabrahams at apple.com
Fri Apr 8 13:26:25 CDT 2016
on Fri Apr 08 2016, Erica Sadun <swift-evolution at swift.org> wrote:
>> On Apr 6, 2016, at 3:32 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>> on Wed Apr 06 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:
>>> On Apr 6, 2016, at 3:25 PM, Dave Abrahams <dabrahams at apple.com> wrote:
>>> These all look reasonable to me.
>>> Lastly, if you want the positive stride reversed, you'd do just that:
>>> (0 ... 9).striding(by: 2).reverse() == [8, 6, 4, 2, 0]
>>> Also reasonable.
>>> Unless there's a compelling reason to fight here, it looks like the
>>> opinion against where I'm standing is pretty overwhelming at least in
>>> this subgroup. To simplify things going forward (and to avoid compiler
>>> warnings, which as Dave A points out is probably an indication of bad
>>> design more than bad users), I'm willing to adopt in as well.
>> Thanks. In that case, I suggest that we entertain two separate
>> 1. add the .striding(by: n) method.
>> 2. add the other range operators.
>> Though they both have obvious benefits, I expect #1 is a much easier
>> sell than #2, which is one good reason to separate them.
> I may have misunderstood the intent so I want to clarify: Dave, you'd like to push on these
> now (starting with #1) and not wait for the rest of the Range stuff to
> come online, right?
I'd like to make progress on #1. I think we should hold
the review until the new range stuff is reviewed (happening in the next
few days). I'm still slightly undecided about #2, but I think it
deserves its own distinct discussion in this list. #2 might imply some
changes to the protocols we're introducing in the swift-3-indexing-model
branch/proposal, so it needs a little time to percolate here I think.
More information about the swift-evolution