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-4746] Let enumerated() count from specified number #47323

Closed
palimondo mannequin opened this issue Apr 30, 2017 · 6 comments
Closed

[SR-4746] Let enumerated() count from specified number #47323

palimondo mannequin opened this issue Apr 30, 2017 · 6 comments
Labels
affects ABI Flag: Affects ABI feature A feature request or implementation improvement standard library Area: Standard library umbrella

Comments

@palimondo
Copy link
Mannequin

palimondo mannequin commented Apr 30, 2017

Previous ID SR-4746
Radar rdar://problem/32725889
Original Reporter @palimondo
Type Improvement
Status Resolved
Resolution Invalid

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement, AffectsABI, LanguageFeatureRequest
Assignee None
Priority Medium

md5: 6e761919c93c823a5699ebfa4cd258e1

Issue Description:

The enumerated() method defined in an extension on protocol Sequence always counts from 0.

When you need the numbers to be counting up from different index, you have to post process the resulting tuple in an inconvenient way.

We could provide an option to count elements from a user specified offset:

[6, 7, 8].enumerated(from: 6)
// [(offset: 6, element: 6), (offset: 7, element: 7), (offset: 8, element: 8)]

If implemented with default parameter, this does not change the usage for existing code, being source compatible with Swift 3. I’m not sure if this change affects ABI, of if it requires passing through swift-evolution process...

@belkadan
Copy link
Contributor

belkadan commented May 2, 2017

It both affects ABI and would have to go through swift-evolution. (Thanks for thinking ahead about that.)

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented May 3, 2017

@belkadan Should I pitch that separately or add it to my proposal for Sequence Cleanup?

@belkadan
Copy link
Contributor

belkadan commented May 3, 2017

It doesn't seem related to the rest of your work there, might as well do it separately.

@palimondo
Copy link
Mannequin Author

palimondo mannequin commented May 7, 2017

I've made a swift-evolution pitch.

@bob-wilson
Copy link

@swift-ci create

@bob-wilson
Copy link

There's no need to have a bug report for this. It has already started with a pitch for swift-evolution and depending on the response might proceed to a proposal. We don't need to track it here as well.

@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
affects ABI Flag: Affects ABI feature A feature request or implementation improvement standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants