Live data from Hacker News

Why is Zig so cool?

nilostolte.github.io

321–330 of 527 posts

Re: Why is Zig so cool?

#321
post #311

Earlier quoted context omitted.

In my opinion, this is an important issue and not "bikeshedding", but it can be discussed whether the term "C/C++" is always an example of that idea or not. I think it is not, but it is connected enough, that I won't use it to side step the issues.

So there will be zero C language constructs, and C standard library functions being called, on your C++ source code?

I mostly write C, but yes even a simple call to e.g. malloc has different semantics in C++ (you need to cast).

Re: Why is Zig so cool?

#322

While some of the features the author references are really interesting, personally I don't see how any of that would justify creating a new memory unsafe language in 2016. I thought it was pretty obvious by now [1][2][3] memory safety is best left to tooling / compilers and not to programmers. [1] https://research.google/pubs/secure-by-design-googles-perspe... [2] https://www.microsoft.com/en-us/msrc/blog/2019/07/we…

I think even in the year of our lord 2016 there's room for a language with safe defaults but seamless interoperability with existing unsafe code. It's certainly an improvement on the status quo and provides an alternative to rewriting the world in Rust or a GC language.

Re: Why is Zig so cool?

#323
post #313

This is a very confusing blog post. I found myself looking for ChatGPT markers because it doesn't make sense to say: omg zig is so much cooler than C here's why, then start listing the absolute basics of the language that are identical in most modern languages without any actual reflection why writing the same thing in a different syntax somehow makes zig superior?

You're absolutely correct! The "how to modify an environment variable" bit and the bin-dec-hex table made me feel the same way. Then I saw the part explaining how to check for duplicates in a row... I'm struggling to understand the point of the article. Testing a text generator?

Also bizarre that it got to the front page of HN while being so low quality :/

Re: Why is Zig so cool?

#324
Zig is so cool, but C is cooler.

I like how Zig feels clear and simple to start with. I like that it gives one toolchain and makes cross compilation easy. I like that it helps people see how systems programming can feel approachable again.

I also like that C has done these things for many years. I can use different tools, link libraries, and trust that it will still work. I can depend on standards that keep improving while staying familiar.

I think Zig is exciting for what it adds today. I think C is cooler because it has proved itself everywhere and still runs the world.

Re: Why is Zig so cool?

#325
post #313

Earlier quoted context omitted.

You're absolutely correct! The "how to modify an environment variable" bit and the bin-dec-hex table made me feel the same way. Then I saw the part explaining how to check for duplicates in a row... I'm struggling to understand the point of the article. Testing a text generator?

Also bizarre that it got to the front page of HN while being so low quality :/

Well i think that is why it got there people really love hating :)

Re: Why is Zig so cool?

#326
post #224

Why are people so obsessed with Zig when Odin has been stable, though not yet with official spec, for such a long time and used in real production for years? Is it just syntax preference or does Zig provide something amazing that I am missing? Not that I use any of them, I am not interested in manual memory management and i stick to Go. But I'm curious.

Are you implying that Zig hasn’t been used in production? What about Tigerbeetle, Bun and Ghostty? I’m using Ghostty as my terminal right now.

I feel like Zig is aiming a lot higher. So that’s why it’s taking longer and also why people are more obsessed with it. The work on doing their own backend and incremental linker is impressive and interesting. So is their attempt at getting IO and async right.

Re: Why is Zig so cool?

#327
post #320

This is a very confusing blog post. I found myself looking for ChatGPT markers because it doesn't make sense to say: omg zig is so much cooler than C here's why, then start listing the absolute basics of the language that are identical in most modern languages without any actual reflection why writing the same thing in a different syntax somehow makes zig superior?

Titles get the headlines.

Honestly this (the fact it is being massively upvoted) looks a lot more like paid promotion. Not the first time and not the only example of submission btw.

Re: Why is Zig so cool?

#328
post #311

Earlier quoted context omitted.

So there will be zero C language constructs, and C standard library functions being called, on your C++ source code?

I mostly write C, but yes even a simple call to e.g. malloc has different semantics in C++ (you need to cast).

Proper C++ should use new, delete, custom allocators, and standard collection types.

Even better, all heap allocations should be done via ownership types.

Calling into malloc () is writing C in C++, and should only be used for backwards compatibility with existing C code.

Additionally there is no requirement on the C++ standard that new and delete call into malloc()/free(), that is usually done as a matter of convenience, as all C++ compilers are also C compilers.

Re: Why is Zig so cool?

#329

This is a very confusing blog post. I found myself looking for ChatGPT markers because it doesn't make sense to say: omg zig is so much cooler than C here's why, then start listing the absolute basics of the language that are identical in most modern languages without any actual reflection why writing the same thing in a different syntax somehow makes zig superior?

What I got was:

  - pointers to bitfields
  - checked bitshifts
  - small ints like u4
  - imperative array initialization blocks
  - test code blocks
  - equivalent of debugger; keyword from js
  - some vague stuff about being able to do at compile time
The rest is pretty generic

Re: Why is Zig so cool?

#330
post #320

This is a very confusing blog post. I found myself looking for ChatGPT markers because it doesn't make sense to say: omg zig is so much cooler than C here's why, then start listing the absolute basics of the language that are identical in most modern languages without any actual reflection why writing the same thing in a different syntax somehow makes zig superior?

Titles get the headlines.

I've learnt this the hard way. The most important thing is to get you to click. Sometimes I'll first iterate over the title before even writing on substack.
Post reply on HN