logoalt Hacker News

do_not_redeemlast Sunday at 4:25 PM3 repliesview on HN

Zig is planning to get rid of explicit `T{}` syntax, in favor of only supporting inferred types.

https://github.com/ziglang/zig/issues/5038

So the explanation of a dot standing in for a type doesn't make sense in the long run.


Replies

dminiklast Sunday at 9:34 PM

Ahh, a perfect example of why Zig is uninteresting to me:

https://github.com/ziglang/zig/issues/5038#issuecomment-2441...

A language hostile to LSP/intellisense.

show 1 reply
flohofwoelast Sunday at 4:31 PM

Ah, I wasn't aware of that proposal. But yeah in that case I would also heavily prefer to "drop the dot" :)

IMHO Odin got it exactly right. For a variable with explicit type:

   a_variable : type = val;
...or for inferred type:

   a_variable := val;
...and the same for constants:

   a_const : type : val;
   a_const :: val;
...but I think that doesn't fit into Zig's parser design philosophy (e.g. requiring some sort of keyword upfront so that the parser knows the context it's in right from the start instead of delaying that decision to a later time).
Defletterlast Monday at 4:43 PM

That's... honestly really disappointing. I use explicit `T{}` because otherwise becomes too unreadable, too Assembly-like: I like knowing what types I'm using. It also provides a convenient thing to click on to inspect the type. I genuinely do not understand this headlong pursuit of conciseness to the detriment of readability.