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

Dave Abrahams dabrahams at apple.com
Sun Mar 27 21:20:41 CDT 2016


on Fri Mar 25 2016, Brent Royal-Gordon <brent-AT-architechies.com> wrote:

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

In what sense, given what you say below?  Isn't this assertion of yours
just an artifact of how NSTimeInterval is defined, rather than anything
intrinsic to dates?

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

-- 
Dave


More information about the swift-evolution mailing list