-
Notifications
You must be signed in to change notification settings - Fork 1.6k
RFC: Collections reform #235
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
Merged
alexcrichton
merged 7 commits into
rust-lang:master
from
aturon:collections-conventions
Oct 29, 2014
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5c31395
RFC: Collections reform
aturon 4034f4a
Added drawbacks
aturon 8ecd360
A few minor fixes
aturon 4490dc7
Added alternative discussion for `for`
aturon d4e9e71
Fix bad references to self
aturon 7eadf34
Substantially revised Borrow trait, add range proposal
aturon 3825c86
Update with minor clarifications and adjustments
aturon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev
Previous commit
Update with minor clarifications and adjustments
- Loading branch information
commit 3825c868bf39741f21f05d5d8c2c65f27637f599
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They could return iterators, and then these iterators could implement them same operators (if they are
Copyor efficientlyCloneable), meaning(a | b) & cwould return an iterator representing the union ofaandball intersected withc. This may be even more suprising, but seems slick.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this functionality could actually be provided generically on iterators that assert that their contents are sorted. Then we don't need to impl this stuff on each Set impl, we just make their iterators impl the (empty) SortedIterator trait. Then it's just
(a.iter() | b.iter()) & c.iter(). Less slick, but much more composable and less of a double-dispatch hell, I think.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I considered moving the various set operations to the iterator level. Indeed, this is how they're implemented in some -- but not all -- cases. So it's partly a question of whether we want to be able to provide specialized implementations (although trait specialization, if it happens, may eventually help there.)
In any case, it might be worth doing some tests to see whether we can get away with generic combinators, as that would be in line with the overall design goals of this RFC.