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-6102] Improve Sequence.elementsEqual and lexicographicallyPrecedes #48657

Closed
moiseev mannequin opened this issue Oct 10, 2017 · 5 comments
Closed

[SR-6102] Improve Sequence.elementsEqual and lexicographicallyPrecedes #48657

moiseev mannequin opened this issue Oct 10, 2017 · 5 comments
Assignees
Labels
feature A feature request or implementation good first issue Good for newcomers improvement standard library Area: Standard library umbrella swift evolution rejected Flag → feature: A feature that was rejected through the Swift evolution process will not do Resolution: Will not be worked on

Comments

@moiseev
Copy link
Mannequin

moiseev mannequin commented Oct 10, 2017

Previous ID SR-6102
Radar rdar://problem/34898959
Original Reporter @moiseev
Type Improvement
Status Closed
Resolution Won't Do
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Improvement, StarterBug, StarterProposal
Assignee @xwu
Priority Medium

md5: 6dbd0c0b3f90bde5117eedcabc37524b

Issue Description:

As best described by @xwu in this comment:

Definitely, we should try to improve the situation, but I question if this is the optimal first bit of improvement. Frankly, as it's currently named, elementsEqual is confusing even for ordered collections; users are much more likely to be comparing two instances of the same type, and they should be reaching for == instead.

What I'm hinting at above is: this function-should it be useful-might be best off renamed to something like lexicographicallyMatches (a la lexicographicallyPrecedes). Then, to transition, a deprecation annotation can be affixed to an elementsEqual stub telling users to use == if possible and to avoid using elementsEqual on unordered collections. I'd also recommend coalescing lexicographicallyPrecedes(_:by: ) and elementsEqual(_:by: ) (the methods that take a custom predicate) into a single lexicographicallyCompares(_:by: ) as they're really not different.

@moiseev
Copy link
Mannequin Author

moiseev mannequin commented Oct 10, 2017

@swift-cicreate

@moiseev
Copy link
Mannequin Author

moiseev mannequin commented Oct 10, 2017

Please note this change requires an evolution discussion and proposal.

@natecook1000
Copy link
Member

If we wanted to be really crazy, we could add Sequence.all(match:), drop elementsEqual(_:), and people could write zip(c1, c2).all(match: ==). Might be harder to mix up the semantics in that case.

@xwu
Copy link
Collaborator

xwu commented Apr 17, 2018

Rejected in SE-0203.

@airspeedswift
Copy link
Member

Closing since SE was rejected.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added will not do Resolution: Will not be worked on and removed StarterProposal labels Nov 11, 2022
@AnthonyLatsis AnthonyLatsis closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2022
@AnthonyLatsis AnthonyLatsis added swift evolution rejected Flag → feature: A feature that was rejected through the Swift evolution process feature A feature request or implementation labels Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A feature request or implementation good first issue Good for newcomers improvement standard library Area: Standard library umbrella swift evolution rejected Flag → feature: A feature that was rejected through the Swift evolution process will not do Resolution: Will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants