[rust-dev] Syntax of vectors, slices, etc

Graydon Hoare graydon at mozilla.com
Mon Apr 23 15:10:34 PDT 2012

On 12-04-23 12:58 PM, Rick Richardson wrote:

> My line of thinking is this:
> If you have an array of four Ints, the type of the array is 4 Ints.
> It's incompatible with an array that is 5 ints without an adaptor.
> Since [] indicates a vector, and a vector in Rust has both a length
> and a type, Why not make the size of the vector the first of two
> parameters in the []?
> e.g.     [N,T]
> or, for unspecified length:  [_,T]  (possibly sugared to [T])

All versions of this syntax that work with the bound-inside-the-brackets
need to have something to say for the 'str' type, which has no brackets.
That's the problem.


More information about the Rust-dev mailing list