let i: i32 = 1;
let &i: &i32 = &1;
let &mut i: &mut i32 = &mut 1;
let (i, &mut j): (i32, &mut i32) = (1, &mut 2);
I'm not sure how you'd recreate this symmetry without using the same symbol in both places. const foos = [("foo", 1, "bar"), ("foo", 1, "bar"), ...];
for (str1, num, str2) in &foos {
// ...
}
For a proper struct you have to name the fields, because otherwise refactoring the fields could cause struct instances to silently get out of sync with the definition.
With the usual warnings approach, you can rely on compiler/IDE/pre-commit tooling to find unused variables - they'll all nag you until it's fixed. With Zig's autofix approach, those problems are immediately silenced and you don't have any help from the compiler or tooling to find unused variables. It's quite an ironic outcome if you think about it.
[1]: https://github.com/ziglang/zig/pull/12803