[swift-evolution] Feature proposal: Range operator with step
Jordan Rose
jordan_rose at apple.com
Fri Mar 25 11:24:07 CDT 2016
> On Mar 25, 2016, at 9:19 , Dave Abrahams via swift-evolution <swift-evolution at swift.org> wrote:
>
>
> on Thu Mar 24 2016, Brent Royal-Gordon <swift-evolution at swift.org> wrote:
>
>>> That
>>> would imply that floating types should not conform to Strideable,
>>> which raises the question of whether Strideable should be folded into
>>> the Integer protocol.
>>
>> Personally, I get a lot of mileage out of conforming NSDate to
>> Strideable.
>
> I just recalled that Unsafe[Mutable]Pointers are also Strideable. So
> Strideable stays.
>
> Question: by what unit should
>
> for d in d0...d2 {}
>
> be iterating? Or should it be disallowed without a .striding(by: )?
>
> If the latter, NSDate might fall into the same bucket as floating types.
Strong vote to require a unit here, especially given that .minutes, .hours, .days, .months, and .years are all non-uniform intervals that are nonetheless useful to stride by!
Jordan
More information about the swift-evolution
mailing list