So I was thinking about what was said about the syntax of vectors and
slices in the previous Tuesday meeting. I thought I'd throw some random
ideas out.
Here are some possibilities (I'm sure there are more). In each case, I
give fixed-length, dynamic, and then slice notation. For better or
worse I omitted the @ and ~ sigils on the vector form. The "M"
indicates where the mut/const would go should they be relevant.
Obviously use fixed-width to view. Graydon suggested perhaps using the
idea of "number vs _" to distinguish static-fixed-length from
dynamic-length vectors, so I pursued that for a while. I always tried
to preserve the rule that the parser knows whether what it is looking at
is an expression (possibly involving constants) or a type name, without
requiring arbitrary lookahead.
One Dimensional Two Dimensional
Fixed Vector Slice Fixed Vector Slice
[5]MT [_]MT [:]MT [5]M[5]MT [_]M[_]MT [:]M[:]MT
[5]MT []MT [:]MT [5]M[5]MT []M[]MT [:]M[:]MT
[5]MT [_]MT []MT [5]M[5]MT [_]M[_]MT []M[]MT
[5 M]T [_ M]T [:M]T [5 M][5 M]T [_ M][_ M]T [:M][:M]T
[5 M]T [M]T [:M]T [5 M][5 M]T [M][M]T [:M][:M]T
[5 M]T [_ M]T [M]T [5 M][5 M]T [_ M][_ M]T [M][M]T
[MT*5] [MT*_] [MT] [M[MT*5]*5] [M[MT*_]*_] [M[MT]]
[MT,5] [MT,_] [MT] [M[MT,5],5] [M[MT,_],_] [M[MT]]
[MT;5] [MT;_] [MT] [M[MT;5];5] [M[MT;_];_] [M[MT]]
[MT:5] [MT:_] [MT] [M[MT:5]:5] [M[MT;_];_] [M[MT]]
(MT*5) vec<MT> [MT] ((MT*5)*5) vec<M vec<MT>> [M[MT]]
[5]MT []MT slice<MT> [5]M[5]MT []M[]MT slice<M slice<MT>>
[MT,5] [MT] slice<MT> [[MT,5],5] [M[MT] slice<M slice<MT>>
Niko
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev