Not sure this even needs a RFC, but pre-RFC was the most fitting title.
I would be happy to work on the implementation - if this is deemed a wanted change.
I am not sure I understand the reasoning why this is not allowed:
struct Foo {
0: i32, // This is the only thing that fails ...
arg_1: i32,
named_1: i32,
}
fn main() {
let foo = Foo { 0: 0, arg_1: 1, named_1: 42} ;
println!("{}", foo.0);
}
fails only at the struct definition with "^ expected identifier". Would it not just be necessary to change 'IDENTIFIER' to 'IDENTIFIER_OR_NUMBER' (pseudo-code wise)?
to make it all work as everything else seems to be able to work with '.0', '0: ', etc.?
I am also not seeing the drawback given that it is already inconsistent right now.
My personal motivation with that is to mirror named function arguments in structs as they then perfectly match the:
0: arg_0, 1: arg_1, named_1: arg_3
pattern. Also getting this change (0: as allowed identifier in structural records) in independent of structural records is one less thing that structural records need to handle - and it is planned as part of their RFC. (https://github.com/rust-lang/rfcs/pull/2584/files/051686558a1b57448193fbc2938f1a3f193e9c7e#diff-82f56a33e385fa4523376256280d53cfR635-R646)
To be precise: I am only suggesting to allow numbers as identifiers, nothing else - so there is still plenty of distinction from Tuple to Struct, but they can be 1:1 mapped, but as for every other identifier you need to be explicit about the 0, 1, ...:
Tuple (i32, i32) ~= Struct { 0: i32, 1: i32 }
[They are not equal, just mappable]