[rust-dev] In favor of types of unknown size
niko at alum.mit.edu
Sat Apr 28 14:44:17 PDT 2012
The main thing I was trying to argue for is not a specific syntax but
rather the idea that a leading @, ~, or & sigil indicates the kind of
pointer, and what comes after indicates the data that is being pointed
at. The orthogonality appeals to me; it seems to make the language "fit
together" more neatly.
As far as pure visual aesthetics, I think what I prefer most is `[T]`
for slices and `vec<T>` for vectors. I proposed this previously but
amended it because we would need to support types like `vec<mut int>`,
which are different from ordinary type parameters that do not permit a
`mut` qualifier. Since type names are no longer keywords, this is
somewhat awkward to do, though of course we could manage it (either by
making `vec` a keyword or by allow `<mut T>` as an alternate type
parameter syntax that can only be used with vectors).
On 4/27/12 11:12 PM, Marijn Haverbeke wrote:
> I must say I prefer Graydon's syntax. `T` sets off all kinds of
> alarms in my head.
> I have no strong opinion on dynamically-sized types. Not having them
> is definitely a win in terms of compiler complexity, but yes, some of
> the things that they make possible are nice to have.
More information about the Rust-dev