On 11/19/13 5:12 PM, Val Markovic wrote:
I felt cheated a bit TBH. It's such an obvious design mistake IMO;
everyone's going to get this wrong because it's counter-intuitive.

I agree that we should change this, but give us some credit: it's only an obvious design mistake now that we've gotten to this point. For those joining us now, we have gone through the following changes starting 3 years ago:

1. `[T]` is always reference counted. Pushing onto a vector was optimized to push in-place iff the reference count was 1. There is `[mut T]` as well. There is no overloading and also no slicing, because there was no region system. 2. `[T]` is always owned and small vector optimized with 4 elements in place (number arrived at through measurements). There is no `[mut T]`. There is no slicing because there is no region system. 3. `[T]` is always owned and not small vector optimized. There is no slicing. 4. We have 4 vector types, `[T, ..N]`, `[T]/&` and `[T]/~` (today `[T, ..N]`, `&[T]`, `~[T]` respectively), as well as `[T]/@` which is reference counted. Vector literals infer to the right one. Owned and managed vectors can be sliced.
    5. We have 4 vector types, `[T, ..N]`, `&[T]`, `~[T]`, and `@[T]`.
    6. We have 3 vector types, `[T, ..N]`, `&[T]` and `~[T]`.

Now we're talking about:

7. We have 1 built-in vector type: `[T, ..N]`. Slices are `Slice<T>` lang items. Owned and managed vectors can be built into the library.

The current status is the product of the slow evolution of a design that predated the region and slicing system, and what seems obvious now was not obvious in retrospect.

Patrick

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to