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-122] Investigate other CollectionType schemes: collections move indices #42744

Closed
gribozavr opened this issue Dec 7, 2015 · 1 comment
Closed
Labels
affects ABI Flag: Affects ABI standard library Area: Standard library umbrella task

Comments

@gribozavr
Copy link
Collaborator

Previous ID SR-122
Radar rdar://problem/21636381
Original Reporter @gribozavr
Type Task
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Task, AffectsABI
Assignee AtOmXpLuS (JIRA)
Priority Medium

md5: 2f461f0712f247f057a521e4163df0e2

Issue Description:

In practice it has turned out that every one of our concrete collection's non random-access indices holds a reference to the collection it traverses. This introduces complexity in implementations (especially as we try to avoid multiple-reference effects that can cause unnecessary COW copies – see Dictionary and Set) and presumably translates into less-efficient codegen. We should consider other schemes.

There are index-less schemes (c.f. D), but we should also consider a scheme where generic indices can't be moved without participation from the collection itself, e.g. collection.nextPosition(index). This would complicate generic code a bit, but working with Array would remain as simple as ever. We could even consider whether random access is special and RandomAccessIndex ought to be incrementable without a collection, although that may give up some error checking opportunities.

@gribozavr
Copy link
Collaborator Author

This is done in Swift 3.

@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 standard library Area: Standard library umbrella task
Projects
None yet
Development

No branches or pull requests

1 participant