by uecker · 2w ago · 0 comments
Defer will also appear in C compilers soon, but personally I still think goto-error handling is clearer.
(Rust has an advantage for temporal memory safety, but this does apply to Zig.)
https://blog.codinghorror.com/falling-into-the-pit-of-succes...
These days I wonder what is harder: 1. problems of collective action or 2. communicating that reducing everything to collective action is the real issue.
C authors created lint for similar reasons.
It has always been a social problem, getting some class of developers to actually care.
Though I've noticed the same trend when reading a famous Rust primer for C++ developers. Like there are obviously so many good and valid arguments when comparing the two languages that would've gotten the point across. Yet the authors felt the need to push it one step further, where the comparison no longer seems fair. Like comparing Rust with C++17 when C++20 provides the same exact feature that Rust claims to provide.
github.com/ityonemo/clr
gcc -fanalyze ...
clang -fsanitize=address ...
etc clang -fbounds-safety
this is dynamic/runtime checking, but still very useful!But while you can have some/most of the benefits Zig has from modern C, I think an underrated benefit is the language culture. As a different language it was the opportunity for a reset, e.g. it's idiomatic Zig to pass allocators to functions, meaning every library in Zig will work this way.
You could do that in C, but none or very few libraries do that so whenever you reach out to third-party dependencies (which is not a lot, in C as in Zig) you have to fight against C's traditional patterns.
People say the same about Rust, and seems tooling for you all mean "convenient cli program" and not "vast IDE support, debuggers, qualified and platforms-specific toolchains, formal verification software".
In those C blows Zig, even Rust, out of the water.
Irrelevant, Zig has nothing to do with Rust. Rust tooling is slow and bloated and comes in ten different pieces you have to install separately.
> Tooling for you all mean "convenient cli program"
Don't put words in my mouth, you clearly have no idea what I mean by good tooling
> Platforms-specific toolchains
With Zig you don't need platform specific toolchains, in-fact a lot of non-Zig C projects (e.g. Uber) use the Zig toolchain just to have hassle-free cross-compilation. It's one statically linked binary you can use (that consequently works flawlessly on any linux distro irrespective of glibc version) and includes clang, linker, and libc headers for every target. You don't need to reach for Docker or sysroots. That's just one of the reasons that make it good.
C will always blow every single language out of the water in support at least because it's the historical and universal programming language. It doesn't mean it's a better designed language.
As soon as you have dependencies you are dealing with however the authors decided to build things.
Part of why languages exist is just to get a new ecosystem.
At this point, you could fork C/C++, only remove features, give it a new name, a new package service, and maybe fork the standard library, and you could end up with something pretty competitive against Zig or Rust.
Yes, new languages try to create a new ecosystem. I think this is a bad thing - we already have too many of such - often somewhat isolated - language ecosystems. But I also do not think we need new ecosystems, when we can evolve the existing one. I have seen C evolve quite a bit over time, so the idea that we have to create new ecosystems to solve problems is wrong in my opinion. C evolves very slowly, which means that some things need more time, but I also think that it is generally a very good thing that it evolves slowly.
This is why new ecosystems starts. Not everyone is ok with the slow pace
But I think a fair comparison of new languages to C has to take modern C features and tooling into account.
1. yeah you can do that, but we should really do some (most? all?) of the things you mention (as well as other safeguards) mandatory
2. your code might be alright, but what about your dependencies ?
It is guaranteed that you cannot write non-modern C code, that's why ppl are using new languages.