On 11/8/13 2:10 PM, Oren Ben-Kiki wrote:
Yes, the down side is another level of indirection. This could be
optimized away for &'static str, but not for &str. Good point.
I apologize for snapping at you.
This thread has become not particularly productive. I'm welcome to
alternative suggestions, but I'd like to suggest that any proposal needs
to accommodate:
1. A coherent story for smart pointers to existential types in which the
size is not known (e.g. `~Trait`).
2. Accommodation for extending the language for custom smart pointers.
3. A story for vectors, including custom ones.
4. Garbage-collected vectors and strings.
5. Lifetime-bounded pointers to array slices. Array slices must not
allow access outside the bounds of the slice, even if those elements are
within the original array.
6. C-like levels of efficiency for vectors and arrays, without extra
levels of indirection.
7. The ability to push onto a unique array if capacity is available
without copying all the elements.
8. Constant strings stored in static memory, without life-before-main.
9. Memory safety.
10. Unicode safety for strings: ensuring that all strings have valid
UTF-8 in them at all times.
There are probably more, but that's my initial list.
I know that many people don't like the fact that, syntactically, vectors
and strings have a sigil in front of them, but please consider that
there are many design constraints here. What works for another language
may not work for Rust, because of these constraints.
Note that I *am* open to other possibilities :) I don't mean to shut
people down! But the design space here is very limited.
Patrick
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev