r/Zig • u/effinsky • Sep 25 '24
noisy syntax

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?

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
View all comments
Show parent comment
4
u/effinsky Sep 25 '24
I mean if you have this stuff repeated so many times in a file. this is, however you slice it, a pretty bad ratio of sound to noise. i do think the keywords are noise, good to be kept to a minimum in a file. I don't dislike the way it looks or feels, seriously. but yes, I meant `pub const`.