> 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.
You can build C projects using Rust and Cargo as well[0], but it requires more work than Zig appears to need. Rust also has good C FFI story and honestly I think we will still see a lot of important code rewritten in Rust. That said, a more ergonomic C which seamlessly replaces the often bloated build configuration of C/C++ projects while allowing a far nicer language to slowly replace the existing code feels like Ty…
Maintain It with Zig
61–70 of 286 posts
Re: Maintain It with Zig
#62Earlier quoted context omitted.
See, I see that as the opposite: it is easy to get offended by the joke precisely because it is not true. IMHO, the second version is better because, by removing the language at hand, it directs the joke at the idea of re-writing everything in the first place, rather than at some specific niche of people who may or may not even actually exist. I could/would also get into a debate about "satire" and what exactly it is…
I think the seminal text on offense, jokes, and satires in the worship of programming languages is probably https://web.archive.org/web/20061110043911/https://fluff.inf... I've found it be to pretty useful in determining why I'm much more sensitive to things I care about than the things I don't, and particularly when jokes carry an element of truth that I cannot bear to acknowledge
Re: Maintain It with Zig
#63Earlier quoted context omitted.
disclaimer: I haven't actually used either, just done a lot of interested reading and a little toying around. One thing that impressed me about Zig is how simple the language is. I get the impression that it would take very little time to properly learn the language and become effective at it. Rust, on the other hand, has a whole lot of complexity even without the ownership semantics. So much to learn and understand.…
"simple" is, unfortunately, not a simple concept, nor does everyone agree on its effects on programs written in a language that is or is not simple. Some people do believe that, let's say "conceptually parsimonious" languages (using complicated words to describe simplicity is amusing to me, sorry) do exactly what you say. Others believe that complexity inherently exists, and you can put it in the language, where a co…
Re: Maintain It with Zig
#64Zig 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-…
The only thing I've found being a pain point is C's biggest pain point: the lack of a proper string type. Even though I've worked for years in the past with C and C++, I still get tripped up, and in Zig I keep on being confused whether I should use raw byte arrays, or sentinel-terminated arrays for certain string manipulations. Maybe I'm not familiar with common idioms in Zig that might help avoid this C-style tracking of string/buffer lengths malarkey that I tend to end up with where a slice is not appropriate.
Maybe a dynamic-length string library is the way forward.
I've always tried as much as possible to treat strings as just opaque data and never look into them, which tends to work well, but in some domains you really need to look at and massage the characters/codepoints/grapheme clusters, and the lack of a first-citizen UTF-8-aware string type is, I think, a bit unfortunate in this day and age. I understand having one of those could make C interop a bit gnarlier (I think Odin's approach of having two separate string types -- one of which is just meant to be used for interop -- should be workable).
Oh, and the ecosystem of libraries is still young. I needed to format timestamps as human readable date/time to a file, and had to step down to C to do something that basic[1], but it'll get there in time, I'm sure.
[1]: "basic" from the perspective of the end-user of the language. Having written a (not even fully featured) date/time library in C++, I consider date and time to be one of the hardest domains I've ever had to work in.
Re: Maintain It with Zig
#65Earlier quoted context omitted.
"simple" is, unfortunately, not a simple concept, nor does everyone agree on its effects on programs written in a language that is or is not simple. Some people do believe that, let's say "conceptually parsimonious" languages (using complicated words to describe simplicity is amusing to me, sorry) do exactly what you say. Others believe that complexity inherently exists, and you can put it in the language, where a co…
There is also the notion of languages you love writing code in vs languages you like reading code in. Languages with more powerful abstraction abilities bring joy to the writer but make things tedious for the reader.
Re: Maintain It with Zig
#66If zig.build can alleviate the pain of building C/C++ projects, then it will surely to replace C in the future. So, IMHO, it's more important to get zig.build right than zig itself
Aren't C projects relatively easy to build? C++ is a little more complicated, so there is more of a push for header only libraries there. I see the problem is probably with external libraries, but that is largely not a huge problem on Linux/Unix. Windows was more of a pain but msys/mingw alleviated most of it.
and that's ignoring the nightmare of cross-compiling with gcc.
andrew kelley has talked about this[1]. his main point was about the number of dependencies you end up with compared to zig, where the standard library includes a high-level build system api. so your zig build scripts are written in ziglang and run by the zig compiler. no extra dependencies.
Re: Maintain It with Zig
#67Earlier quoted context omitted.
"simple" is, unfortunately, not a simple concept, nor does everyone agree on its effects on programs written in a language that is or is not simple. Some people do believe that, let's say "conceptually parsimonious" languages (using complicated words to describe simplicity is amusing to me, sorry) do exactly what you say. Others believe that complexity inherently exists, and you can put it in the language, where a co…
There is also the notion of languages you love writing code in vs languages you like reading code in. Languages with more powerful abstraction abilities bring joy to the writer but make things tedious for the reader.
I personally would not agree with
> Languages with more powerful abstraction abilities bring joy to the writer but make things tedious for the reader.
I find map/filter to be easier to read than a C-style for loop. Things that are conceptually denser make discussion between experts easier, even if it makes things harder for non-experts. This is why jargon exists, for example.
Re: Maintain It with Zig
#68Earlier quoted context omitted.
disclaimer: I haven't actually used either, just done a lot of interested reading and a little toying around. One thing that impressed me about Zig is how simple the language is. I get the impression that it would take very little time to properly learn the language and become effective at it. Rust, on the other hand, has a whole lot of complexity even without the ownership semantics. So much to learn and understand.…
> It seems, from looking at others' code, that there is a very strong temptation to lean on `unsafe` instead of figuring out how to solve a problem within the constraints it normally applies. Are you sure those examples of unsafe Rust code were written using unsafe in order to work around safety constraints due to difficulty? I ask because there are some very real and valid use cases for unsafe code in Rust that have…
The big bias I'm working from here is that, as an outsider, I have a hard time reconciling all the big talk about how Rust makes it impossible to experience certain classes of bugs, with the existence of a known set of things that its type checker can't check, and which includes a lot of things that are difficult to avoid. One could be forgiven for thinking that the Rust community has a habit of keeping its fingers crossed behind its back when talking.
I don't want to make the perfect the enemy of the good, of course. I realize the feature is there for an important reason. But it sure looks to me like Zig is also good despite being imperfect. Perhaps they're both similarly good languages.
Re: Maintain It with Zig
#69Earlier quoted context omitted.
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…
As a counterpoint, I remember when someone satirized RIIR on HN and the post was flagged into oblivion even though the comments section was mostly approving. https://news.ycombinator.com/item?id=25198571 Someone reposted the same document with Rust replaced with "$hotlang" which, for a reason you can guess, wasn't flagged at all: https://news.ycombinator.com/item?id=25208313 My impression is that there are more than…
Re: Maintain It with Zig
#70To some extent. Rust, due to relying on LLVM, is limited by its available targets; and so cannot enjoy the full access that C/C++ can. The same is true for Zig, however, since it does not compile to C.