logoalt Hacker News

kachapopopowyesterday at 10:41 PM4 repliesview on HN

I could never get into zig purely because of the syntax and I know I am not alone, can someone explain the odd choices that were taken when creating zig?

the most odd one probably being 'const expected = [_]u32{ 123, 67, 89, 99 };'

and the 2nd most being the word 'try' instead of just ?

the 3rd one would be the imports

and `try std.fs.File.stdout().writeAll("hello world!\n");` is not really convincing either for a basic print.


Replies

usrnmyesterday at 10:59 PM

I will never understand people bashing other languages for their syntax and readability and then saying that they prefer Rust. Async Rust is the ugliest and least readable language I've ever seen and I've done a lot of heavily templated C++

show 3 replies
von_lohengrammyesterday at 10:53 PM

> and the 2nd most being the word 'try' instead of just ?

All control flow in Zig is done via keyword

dwbyesterday at 10:54 PM

These are extremely trivial, to the point that I don’t really know what you’re complaining about. What would expect or prefer?

show 1 reply
throwawaymathsyesterday at 11:14 PM

'const expected = [_]u32{ 123, 67, 89, 99 };'

constant array with u32, and let the compiler figure out how many of em there are (i reserve the right to change it in the future)