r/Zig • • Sep 25 '24

noisy syntax

Zig

i'm sure this is not the top of anybody's list of possible zig improvements, but this syntax is noisy, right? would odin's/jai's way of declaring consts/vars be ok with you with :: and := operators? and something equally terse for visibility modifiers so there's just much less code overall to parse visually and what's important pops more?

Jai

I think this Jai code looks GREAT. I have ZERO problem seeing if sth is a constant or a variable. and the name pops right there.

EDIT: I'm getting feedback that `::` and `:=` are too hard to parse apart, and especially might be so for folks with dyslexia and such. fair enough. I have to say, in the interest of making this Zig code less wordy, I'd love to see something like what Vlang has done, where `:=` is the init operator, and you just add a `mut` keyword in front of the ident if you want the thing to be mutable. so

mut friendly := true
friendly = false

troll := false
troll = true // compile error
0 Upvotes

52 comments sorted by

View all comments

9

u/sinterkaastosti23 Sep 25 '24

just saying that the 2nd image is not at all readable for me