-
Notifications
You must be signed in to change notification settings - Fork 13.4k
add new vector representation as a library #11682
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
Conversation
+1 yes plz |
golf claps |
Nice work! We should probably discuss this before merging. |
I don't understand what "I don't really expect DST to happen for vectors" means. This pull request uses slices, after all. Slices are just a special case of DST. Regardless, this PR looks good to me. |
@pcwalton: As in unlike traits, stuff like |
The intent is that ~[T] won't have a capacity under DST. It will simply be a boxed, "unsized" array, pointer plus length. |
@brson: I know, and I think it would be simpler to have a single owned vector type. It's true that a 2-word representation could probably save memory in some cases, and having |
What about |
@pcwalton: It could just remain as it is now though. (anyway I fine with doing both, I just didn't the end decision would end up adding |
I also have concerns about Regardless, everything I understand about DST means that Are there any objections to merging this now? |
This is just an initial implementation and does not yet fully replace `~[T]`. A generic initialization syntax for containers is missing, and the slice functionality needs to be reworked to make auto-slicing unnecessary. Traits for supporting indexing properly are also required. This also needs to be fixed to make ring buffers as easy to use as vectors. The tests and documentation for `~[T]` can be ported over to this type when it is removed. I don't really expect DST to happen for vectors as having both `~[T]` and `Vec<T>` is overcomplicated and changing the slice representation to 3 words is not at all appealing. Unlike with traits, it's possible (and easy) to implement `RcSlice<T>` and `GcSlice<T>` without compiler help.
This does not attempt to fully propagate the mutability everywhere, but gives new code a hint to avoid the same issues.
This is just an initial implementation and does not yet fully replace `~[T]`. A generic initialization syntax for containers is missing, and the slice functionality needs to be reworked to make auto-slicing unnecessary. Traits for supporting indexing properly are also required. This also needs to be fixed to make ring buffers as easy to use as vectors. The tests and documentation for `~[T]` can be ported over to this type when it is removed. I don't really expect DST to happen for vectors as having both `~[T]` and `Vec<T>` is overcomplicated and changing the slice representation to 3 words is not at all appealing. Unlike with traits, it's possible (and easy) to implement `RcSlice<T>` and `GcSlice<T>` without compiler help.
This is just an initial implementation and does not yet fully replace
~[T]
. A generic initialization syntax for containers is missing, and the slice functionality needs to be reworked to make auto-slicing unnecessary.Traits for supporting indexing properly are also required. This also needs to be fixed to make ring buffers as easy to use as vectors.
The tests and documentation for
~[T]
can be ported over to this type when it is removed. I don't really expect DST to happen for vectors as having both~[T]
andVec<T>
is overcomplicated and changing the slice representation to 3 words is not at all appealing. Unlike with traits, it's possible (and easy) to implementRcSlice<T>
andGcSlice<T>
without compiler help.