[rust-dev] In favor of types of unknown size

Patrick Walton pwalton at mozilla.com
Sat Apr 28 03:53:01 PDT 2012

On 04/27/2012 03:15 PM, Niko Matsakis wrote:
> Hi,
> This is a post I recently put on my blog. I thought I'd post it to the
> mailing list as it pertains to our recent discussion on the syntax of
> vectors, slices, and so forth. I feel like I'm harping on this issue so
> I think it's the last thing I will write about it for a while. =)

I like the idea of eliminating [T]/@ in favor of @[T]; it simplifies the 
user-facing syntax and semantics a lot.

On the other hand, I agree with Marijn that []T doesn't look as nice as 
[T] (although Go is popularizing the former). [:]T is also 
strange-looking. There's also the issue that users might use &[]T, which 
is almost never useful, instead of the more-useful [:]T. I'd honestly be 
ok with going back to vec<T> or vec<mut T> for the vector type and using 
[T] for the slice, to discourage this hazard.


More information about the Rust-dev mailing list