Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6901] parameter name of stride is misleading #49450

Closed
swift-ci opened this issue Feb 2, 2018 · 3 comments
Closed

[SR-6901] parameter name of stride is misleading #49450

swift-ci opened this issue Feb 2, 2018 · 3 comments
Labels
improvement standard library Area: Standard library umbrella

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Feb 2, 2018

Previous ID SR-6901
Radar None
Original Reporter smartgo (JIRA User)
Type Improvement
Status Resolved
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement
Assignee None
Priority Medium

md5: e49795cfba6446e4efab625e4191fc75

Issue Description:

The `stride(from:to:by)` function is misleading, as it never reaches the `to` value. When I go from A to B, I expect to end up at B, not stop just short of B.

I'd suggest using `towards` instead of `to`.

I suspect leaving it as is will be source of many bugs. I spent an hour tracking down a bug until I finally isolated the stride function as the issue and read the surprising documentation for this function.

@belkadan
Copy link
Contributor

belkadan commented Feb 2, 2018

cc @airspeedswift

@airspeedswift
Copy link
Member

I'm not sure `towards` is better than `to`, seems differently misleading. `upToButNotIncluding` is what it really is, but my understanding is this is the fairly common meaning of `to` (as compared to `through`).

This should be raised as a question (and, eventually, a proposal pitch) on swift evolution, rather than filed as a jira. Closing as behaves correctly for now.

@airspeedswift
Copy link
Member

You can find more detail on the evolution process here: https://github.com/apple/swift-evolution/blob/master/process.md

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

3 participants