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

Brent Royal-Gordon brent at architechies.com
Fri Mar 25 18:09:03 CDT 2016


> 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.

Floating-point seconds (as NSTimeIntervals) are the natural Strideable.Stride, but it's not particularly clear to me that you want 1 second to be a default stride. It's the default you would guess, but it's not actually a particularly useful default.

-- 
Brent Royal-Gordon
Architechies



More information about the swift-evolution mailing list