-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Low priority proposal: Shorten 'const' to 'cn' #5215
Comments
|
So we have |
Or maybe |
I dislike this proposal a lot as One of Zig's Zens is "Favor reading code over writing code.", and in my opinion, this change would violate that Zen. |
Oh, and it might also violate: |
By the (-1) reactions I suppose |
Ergonomics view:
|
|
Related: #5076
Cons:
cn
needs context to be associated with 'constant declaration', while 'const' is self explanatorycn
vsfn
. not as distinguishable asconst
andfn
const func = fn(...) Type {}
vscn func = fn(...) Type {}
if
andcn
cn
vsif/else/switch/while
Pros:
cn
is shorter thanconst
cn
is also shorter thanvar
const
appears very frequently in code.cn
and 'constant declaration' will happen quickly for newcomers.cn
andconst
in a transition period, and let zig fmt convert to the new form in the meantime[]cn u32
vs[]const u32
in that the type will stand out more than the immutability qualifier.An alternative to
cn
isdf
for define, but[]df u8
doesn't work, whereas[]cn u8
is permissible. Related: #5056The text was updated successfully, but these errors were encountered: