[swift-evolution] [Proposal] Conventionalizing stride semantics

Dmitri Gribenko gribozavr at gmail.com
Wed Mar 2 03:23:13 CST 2016


On Wed, Mar 2, 2016 at 1:20 AM, Brent Royal-Gordon via swift-evolution
<swift-evolution at swift.org> wrote:
>> In other words, the contortion I must accept is this: "through"
>> doesn't go with "stride", even though it should. Mentally rearrange to
>> put "through" between start and end, moving the word "stride" after
>> the end: 1 through 10, stride by 8. With this approach, I can
>> understand why someone would name the two stride styles "to" and
>> "through". Consider the typical (American?) English phrase "open Mon
>> thru Fri, 9 to 5": Fri is included, but 5 is excluded.
>
> So in other other words, the change from `stride(from: 1, to: 2, by: 0.1)` to `1.stride(to: 2, by: 0.1)` is the source of the problem and should be reversed.

It is reversed in SE-0006.

https://github.com/apple/swift-evolution/blob/master/proposals/0006-apply-api-guidelines-to-the-standard-library.md

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/


More information about the swift-evolution mailing list