Live data from Hacker News

Maintain It with Zig

kristoff.it

31–40 of 286 posts

Re: Maintain It with Zig

#31
post #8
post #6

Zig is a very interesting language. You are able to do thing that would require wizard level skills in C with simple plain language construct. Like serializing/deserializing an enum variants over the wire for example in the most efficient way (look at std.json.{parser, stringify} [0]). > soon we’ll also have a package manager This. If they succeed to do this (and I have my doubts) it will be a paradigm shift for low-…

I've been paying attention to Zig posts on HN, mostly just because it seems well-liked and I think Andrew Kelley is interesting/smart. Would it be fair to say that Zig is to C, what Rust is to C++? Or are they both just kind of...low-ish-level systems languages solving similar problems, differently?

Many people say this, and there's some truth to it, but like all analogies, it can be useful in some contexts but not others.

The issue with this analogy is that it assumes that C, one of the languages used in the most diverse set of circumstances ever, means the same thing to everyone. Same with C++, frankly.

Re: Maintain It with Zig

#32

Earlier quoted context omitted.

Not sure if this transpired in the writing, but my interpretation of RIIR, partially informed by the chat with JT [0], is that this is a sentiment that I guess is there in some people, but that it was never something officially sanctioned. [0] https://www.youtube.com/watch?v=X7ny7Qrsbd8&t=5391s

It is a weird self-fulfilling thing. People talk about it like it's a thing, so it's a thing, even if there's very little actual evidence of anyone sincerely holding this belief. People repeat that there's this plague of folks requesting that projects be re-written, and while it is literally true that I have seen two or three instances of this (you link to one of them, and notably it is not anyone harassing maintaine…

Why does it matter?

Re: Maintain It with Zig

#34
post #8
post #6

Zig is a very interesting language. You are able to do thing that would require wizard level skills in C with simple plain language construct. Like serializing/deserializing an enum variants over the wire for example in the most efficient way (look at std.json.{parser, stringify} [0]). > soon we’ll also have a package manager This. If they succeed to do this (and I have my doubts) it will be a paradigm shift for low-…

I've been paying attention to Zig posts on HN, mostly just because it seems well-liked and I think Andrew Kelley is interesting/smart. Would it be fair to say that Zig is to C, what Rust is to C++? Or are they both just kind of...low-ish-level systems languages solving similar problems, differently?

> Would it be fair to say that Zig is to C, what Rust is to C++?

I don't think that's the parallel I would draw.

Rather, I think both Zig and Rust aim to serve the use cases C and C++ do, but Zig and Rust pick different points on the tradeoffs involving safety. Zig feels like a "better C", in the sense of bringing modern language features to C, but it chooses safer rather than safe. Rust supplies modern language features as well, and chooses to prioritize safe; sometimes that comes at the expense of other factors, such as productivity or compile time. I personally prefer the point on the spectrum that Rust chose, but I think Zig still offers improvements over C.

Re: Maintain It with Zig

#35
post #15
post #8

Earlier quoted context omitted.

I've been paying attention to Zig posts on HN, mostly just because it seems well-liked and I think Andrew Kelley is interesting/smart. Would it be fair to say that Zig is to C, what Rust is to C++? Or are they both just kind of...low-ish-level systems languages solving similar problems, differently?

I think that's correct with some overlap, yes. Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less. I feel like Rust wants to replace C but it also wants to replace C++. And given the complexity difference between the two languages, that means that Rust will end up closer to C++ than to C. So there's some overlap based on how Rust positions itself, but not based on how Zig pos…

> Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less.

The ZIG compiler requires a C compiler to compile to a native executable though.

Re: Maintain It with Zig

#36

Agreed for sure that working with C and C++ is the only way forward for systems languages. Rust's expression of this is the zero-cost C FFI, using native platform tooling, and stuff like that. Rust was never about re-writing the world, after all, its reason for existing was to eventually improve Firefox. The very first presentation about Rust ( http://venge.net/graydon/talks/intro-talk-2.pdf ) says "We are not “rewri…

I admire your use of special quotes to not break my mental parsing of your quote.

Re: Maintain It with Zig

#37
post #5
post #4

Interesting; this piece advocates for porting only (or at least initially) the build system of C/C++ projects to use the Zig compiler and the build.zig build system for cross-compiling dependencies. A package manager in the works could be interesting too. I don't do C/C++ development. How many headaches would using Zigs compiler & build system solve?

Zig has painless cross compilation, with gcc or clang it's a nightmare

I would like to see that painless cross compilation for UWP applications.

Truth is that cross compilation always breaks down in complex deployment use cases.

Re: Maintain It with Zig

#38
post #8

Earlier quoted context omitted.

I've been paying attention to Zig posts on HN, mostly just because it seems well-liked and I think Andrew Kelley is interesting/smart. Would it be fair to say that Zig is to C, what Rust is to C++? Or are they both just kind of...low-ish-level systems languages solving similar problems, differently?

> Would it be fair to say that Zig is to C, what Rust is to C++? There's definitely something to that analogy, but I think it also misses a lot of really important details. For example, Zig has generics, which right off the bat makes it hard to say that it's "like C". Also Rust enforces memory safety, which isn't like C or C++.

I mean, C11 also has generics, but I would really suggest not using it X). See https://en.cppreference.com/w/c/language/generic

Of couse, it's a much less powerful feature, there's nothing like interfaces or stuff, just a way to "overload" based on the type.

Re: Maintain It with Zig

#39
post #15

Earlier quoted context omitted.

I think that's correct with some overlap, yes. Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less. I feel like Rust wants to replace C but it also wants to replace C++. And given the complexity difference between the two languages, that means that Rust will end up closer to C++ than to C. So there's some overlap based on how Rust positions itself, but not based on how Zig pos…

> Zig's explicit goal - as stated by the creator - is to replace C. Nothing more, nothing less. The ZIG compiler requires a C compiler to compile to a native executable though.

To be fair, the C compiler also requires a C compiler. Bootstrapping is a common milestone in language development (Rust can bootstrap itself too), so while the current state of affairs for Zig might require a C compiler, that's not necessarily written in stone.

Re: Maintain It with Zig

#40

> To improve our critical infrastructure we must improve the developer experience (DX) of systems programming, but rewriting everything is not the only answer. I like Kristoff from what I've read of him. He seems like a leader who will take responsibility and not shy away from hard decisions. On that quality alone, my money is on Zig winning systems programming over Rust in 10 years.

When choosing between Zig and Rust for systems programming, I would reach for Rust most of the time. It's just a more expressive language with some seriously awesome compile-time guarantees. There are three things that bother me about Rust: bloated binaries, slow compile times, and dependency bloat (accidentally building 5 versions of the same crate). But seeing as it's being integrated into the Linux Kernel, I think Rust has a long and bright future in that space. Having said that, I think Zig would be a really great language for kernel programming.
Post reply on HN