5 ms·
I have to admit I don’t really understand the problem Zig is trying to solve. If you’re not trying at the language level to address the core problems of C/C++,
by cageface 2y ago
I have to admit I don’t really understand the problem Zig is trying to solve. If you’re not trying at the language level to address the core problems of C/C++, like Rust is, then it seems like you’re just making a more ergonomic version of those languages and that’s not enough to overcome how deeply entrenched they are.
- lionkor 2y agoZigs tight C integration makes it easy to just start using Zig in an existing C codebase, which is a great way to overcome the challenges you've mentioned. It doesn't need to replace C all at once, just slowly.
- cageface 2y agoSure but is that really enough to get buy in on a whole new language? Especially when the new language still leaves open the door for so many of the critical problems with C?
- throwawaymaths 2y agoI mean zig really leaves open ONE door, which is temporal memory safety. It is likely that zig will solve this. Rust says you must solve this with the type system. I'm not convinced that is the case.
- kaba0 2y agoAlso, it doesn’t really have a solution. There are safe ways to concurrently access the same memory region, that rust disallows without unsafe, and if you are writing a high-performance language runtime you might well need these features.
- throwawaymaths 2y agoYeah but you'll still need something to live around the high performance features and a mechanism to check temporal memory safety would be nice.
- flohofwoe 2y agoDangling references is about the only C problem that Zig doesn't fix with language/compiler features, everything else is taken care of and mostly in a quite elegant and minimalistic way. Also Zig doesn't need to replace C to be successful, just augment it - and for that it's a already a really good choice.
- anonymoushn 2y agoA couple years ago I evaluated Rust for a low-latency application that does math and has a websocket and http client. I didn't use Rust because basically every library for speaking these protocols thought that it was fine to call the global allocator, or run UTF-8 validation on the returned buffers, or pull in a huge async runtime, etc.
- vanderZwan 2y agoDisclaimer: I don't really write i anything in any of the four languages mentioned, so this is just my impression from the outsid looking in, but I'm sure that for many people the ergonomics are one of the core problems of C/C++. Matklad also had an interesting take in one of their blogs: if you have to write unsafe code, then Zig is actually both a more ergonomic language than Rust, and easier to write "safe" unsafe code in.
- pjmlp 2y agoBasically it is Modula-2 with a C facelift, and compile time metaprogramming, for those that want Safe C. Which means, while the safety is much better than raw C, with proper strings and arrays, alongside stronger type system, it still has UAF as possible gotcha.
- jedisct1 2y agoAlong with Go, it's the most please and most productive language I've used for the past 10 years. And I honestly think I'd have completely stopped writing code if I hadn't discovered Zig, after Rust made me hate what I used to love.
- cageface 2y agoThat's great but if you're getting paid to write that code you're not getting paid to enjoy it. You're getting paid to write code that doesn't have bugs and security holes. Our profession's tendency to take the easy way out on tech choices is eventually going to lead to the kind of regulation and certification other engineers are subject to.
- deagle50 2y agoSome people want to enjoy work. And it likely they're referring to personal projects.