In C/C++, you can write
struct Point {
float x, y, z;
};
In Zig, you have to write
const Point = struct {
x: f32, y: f32, z: f32
};
The extra typing required seems like a step backwards, and will be difficult to "sell" to C users.
I propose to go back to using semicolons to separate declarations within structs, and allowing commas to chain fields of the same type.
const Point = struct {
x, y, z: f32;
};
This would make all the more sense given Zig's excellent feature of letting the compiler decide the layout of structs: declare your struct members in the order that's easiest to read, without worrying about wasted bytes.
Back-ward compatibilities, habits, already known territories and/or traditions are not a step forward either.
You suggest to make Zig resemble to Python to convince C users. What about to leave your comfort's zone and let Zig preserve, or even better, grow its own identity?
Thank you for your interest in Zig but you are more and more Zig's users those last months to try to strip off the grammar which role is to make the intent clear for every users who read the code in order to try typing a few less characters in your programs.
I have to ask: is that really the direction for a language who finally is about to step into the light?
@kenaryn I wouldn't dream of trying to strip zig of its identity. That identity however, in my humble opinion, has much less to do with its syntax than with the many clever solutions it brings to long-standing problems.
Making the syntax as easy as possible to read, write and understand seems to me the right thing to do just before the language becomes popular.