[swift-evolution] Feature proposal: Range operator with step

Dave Abrahams dabrahams at apple.com
Wed Apr 6 16:32:05 CDT 2016


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.
>
>     -- 
>     Dave
>
> 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
proposals:

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.

-- 
Dave


More information about the swift-evolution mailing list