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

Milos Rankovic milos at milos-and-slavica.net
Wed Apr 6 16:15:05 CDT 2016

Hi Ted,

> that would imply the ‘by”value should/must always be an absolute value?

In a way: Instead of `Strideable.Stride` I would suggest `Strideable.Distance`.

At any rate, leaving the sign to be direction indicator makes it forever necessary for everyone to make this counterintuitive metal gymnastics, since most of the time in life we do not walk backwards, even when we are returning back whence we came from!

What do you think?


> On 6 Apr 2016, at 21:34, Ted F.A. van Gaalen <tedvgiosdev at gmail.com> wrote:
> Hello Milos,
> Good question
> was thinking about this too.
> that would imply the ‘by”value should/must always be an absolute value?
> however (if it is a var) it cannot be guaranteed to be + or - 
> that’s why I thought to leave it as is.
> ?
> TedvG
>> On 06.04.2016, at 22:18, Milos Rankovic <milos at milos-and-slavica.net <mailto:milos at milos-and-slavica.net>> wrote:
>>> On 6 Apr 2016, at 21:08, Ted F.A. van Gaalen via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> v1 >  v2:   is allowed and correctly evaluated.  e.g. (8.0…-3.14159).by(-0.0001) 
>> If the range does not assume `start >= end`, is it still necessary to also indicate the traversal direction with the sign of the step (`-0.0001`)?
>> milos

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160406/f2239f32/attachment.html>

More information about the swift-evolution mailing list