I mean, is this C-like?
fn add(a: i32, b: i32) i32 {
return a + b;
} fn add(a: i32, b: i32) i32 {
return a + b;
}Rust quickly becomes harder though, while Zig is much easier to grasp.
The only thing that C has taken from Algol, was structured control and data.
int** arr1_of_arr2_of_arr3_of_ptr_to_ptr_to_int[1][2][3]
In this case, spiraling between [1], ×, [2], ×, [3], int is obviously wrong, the correct reading order is [1], [2], [3], ×, ×, int. (Edit: read × = *)The Right-Left Rule is quoted less frequently on HN but it's a correct algorithm for deciphering C types: http://cseweb.ucsd.edu/~ricko/rt_lt.rule.html
char * const (*(* const bar)[5])(int )
And its translation: declare bar as const pointer to array 5 of pointer to function (int) returning const pointer to char
This seems like what I'd get from the spiral technique.But then, of course, it wouldn't have much to do with Zig's "appeal as better C than C", which prompted this whole discussion.