4 ms·
I totally vibe with the intro but then the rest of the article goes on to be a showcase bits of zig. I feel what is missing is how each feature is so cool comp
by pyrolistical 11mo ago
I totally vibe with the intro but then the rest of the article goes on to be a showcase bits of zig.
I feel what is missing is how each feature is so cool compared to other languages.
As a language nerd zig syntax is just so cool. It doesn’t feel the need to adhere to any conventions and seems to solve the problems in the most direct and simple way.
An example of this declaring a label and referring to a label. By moving the colon to either end it makes labels instantly understood which form it is.
And then there is the runtime promises such as no hidden control flow. There are no magical @decorators or destructors. Instead we have explicit control flow like defer.
Finally there is comptime. No need to learn another macro syntax. It’s just more zig during compilation
- deleted 11mo ago[deleted]
- rvrb 11mo agomatklad did it justice in his post here, in my opinion https://matklad.github.io/2025/08/09/zigs-lovely-syntax.html https://matklad.github.io/2025/08/09/zigs-lovely-syntax.html
- srcreigh 11mo agoThread: https://news.ycombinator.com/item?id=44855881 https://news.ycombinator.com/item?id=44855881
- badtuple 11mo agoI was also curious what direction the article was going to take. The showcase is cool, and the features you mentioned are cool. But for me, Zig is cool is because all the pieces simply fit together with essentially no redundancy or overloading. You learn the constructs and they just compose as you expect. There's one feature I'd personally like added, but there's nothing actually _missing_. Coding in it quickly felt like using a tool I'd used for years, and that's special. Zig's big feature imo is just the relative absence of warts in the core language. I really don't know how to communicate that in an article. You kind of just have to build something in it.
- rvrb 11mo agoout of curiosity, what feature do you want?
- brucehoult 11mo agoThe feature I want is multimethods -- function overloading based on the runtime (not compile time) type of all the arguments. Programming with it is magical, and its a huge drag to go back to languages without it. Just so much better than common OOP that depends only on the type of one special argument (self, this etc). Common Lisp has had it forever, and Dylan transferred that to a language with more conventional syntax -- but is very near to dead now, certainly hasn't snowballed. On the other hand Julia does it very well and seems to be gaining a lot of traction as a very high performance but very expressive and safe language.
- zevets 11mo agoI think this is a major mistake for Zig's target adoption market - low level programmers trying to use a better C. Julia is phenomenally great for solo/small projects, but as soon as you have complex dependencies that _you_ can't update - all the overloading makes it an absolute nightmare to debug.
- pjmlp 11mo agoAda has them, and I guess we all agree on its systems programming nature.
- brucehoult 11mo agoNOOOO! What Ada (and Rust) calls generics is very different -- it is like template functions in C++. In those languages the version of the function that is selected is based on the declared type of the arguments. In CLOS, Dylan, Julia the version of the function that is selected is based on the runtime type of the actual arguments. Here's an example in Dylan that you can't do in Ada / Rust / C++ / Java. define method fib(n) fib(n-1) + fib(n-2) end; define method fib(n == 0) 0 end; define method fib(n == 1) 1 end; The `n == 1` is actually syntactic sugar for the type declaration `n :: singleton(1)`. The Julia version is slightly more complex. fib(n) = fib(Val(n)) fib(::Val{n}) where {n} = fib(n-1) + fib(n-2) fib(::Val{0}) = 0 fib(::Val{1}) = 1 println(fib(30)) This is perhaps a crazy way to write `fib()` instead of a conventional `if/then/else` or `?:` or switch with a default case, but kinda fun :-) This of course is just a function with a single argument, but you can do the same thing across multiple arguments. define method ack(m, n) ack(m-1, ack(m, n-1)) end; define method ack(m == 0, n) n+1 end; define method ack(m, n == 0) ack(m-1, 1) end;