>> One practical reason is that interval.start must always be before 
>> interval.end, so this makes striding in reverse difficult.
> 
> We could declare that negative strides cause us to start at the end rather 
> than at the start.

I've noticed in the past that the Swift standard library does not like to 
branch on sign. Of course, you could decide you just don't care in this 
particular case.

> None of those syntaxes fly for me, I'm afraid.  They all look like line noise 
> (and some have precedence problems); I much prefer requiring a set of 
> parentheses.

Even the free-function syntax?

>>    for lat: CGFloat in stride(-60…60, by: 30) {
>>         print(lat)
>>   }

One more alternative, which reads sort of backwards but has clear precedence, 
no line noise, and no free functions:

        for lat: CGFloat in 30.strideOver(-60...60) {
                ...
        }

-- 
Brent Royal-Gordon
Architechies

_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to