4 ms·
> Take a look at some of the checks Zig has. I did, to make sure I wasn't missing something. There's nothing new there, and some things are missing. (This is n
by Rusky 7y ago
> Take a look at some of the checks Zig has.
I did, to make sure I wasn't missing something. There's nothing new there, and some things are missing. (This is not bad, Zig is still in development, but it's not exactly a new approach either.)
> only C++ and Scala contend to be as complex as Rust or more. ... If you, like me, don't particularly like complex languages, then the complexity has a cost.
This is why I linked our Reddit conversation- Rust is nowhere near as complex as C++, and its particular complexity's costs are not difficulty in reading or code review.
> If you have an alternative to achieving a similar level of correctness with a much simpler language, I would very much prefer that.
But this is exactly my point- I don't believe Zig is such an alternative! Zig and Rust both improve over C and C++'s complexity and readability, leading to some general correctness improvements; so far only Rust does anything different to address memory safety.
- pron 7y ago> There's nothing new there, and some things are missing. And it still goes further than C sanitizers (except the glaring missing piece of use-after-free, which I'm sure will be addressed). > Rust is nowhere near as complex as C++ It's hard to quantify this, but I think few people would point at any language (in real use) other than Scala, C++ and Ada as being as or more complex than Rust, so it's at the very top. Some people are perfectly OK with that and even prefer such languages. Rust is well beyond my language complexity comfort level (even C# is too complex for my taste, and, as a high-level language it offer much better abstraction than Rust, or any low-level language). So if C++ is at 500 and Rust is at 300, that doesn't mean much if I want to be at 50 or 100. > Zig and Rust both improve over C and C++'s complexity and readability I don't see it this way. I find it hard to put C and Zig in the same category as Rust. > so far only Rust does anything different to address memory safety. I disagree with that, too. Rust is the only one that addresses memory safety using sound guarantees. If you run tests on a Zig program out of the box you won't have array overflows; that's not what you get in C and C++. Zig's "big idea" or "doing anything different" is how it does partial evaluation with a single construct (comptime) that is drastically simpler than anything I've seen. In other words, as far as simplifying languages with tough requirements for low-level programming, it's rather revolutionary. That's my preferred direction for programming languages.
- Rusky 7y ago> If you run tests on a Zig program out of the box you won't have array overflows; that's not what you get in C and C++. Build a C program in the right mode (also required for Zig) and you get exactly the same thing.
- pron 7y agoWhat mode would that be? The various fsanitize options? C doesn't have slices. Zig also allows turning on safety on a scope level. Not to mention the powerful comptime polymorphism/introspection mechanism that allows working in a more typesafe manner than C, while still being much simpler than Rust.
- Rusky 7y agoI don't see how Zig comptime is any simpler than Rust. Frankly, it seems more of a kluge. But we've already been over this before. :)
- pron 7y agoA single construct does the work, or most of the work, of generics, value generics, const fn, traits, attributes (although I expect some form of attributes might be added to Zig) and macros, and it does so without type-level programming or macro-level programming, both their own mini-languages. A kludge is in the eye of the beholder, but one is simpler than five or six.
- zozbot234 7y agoRust has procedural macros too. And they're not a separate "mini-language" like the C++ template hacks, they just use Rust itself, except with a phase separation involved since they run at compile time.
- pjmlp 7y agoIn C++17 and moreso in C++20, doing C++ template hacks is only excusable for legacy code, or trying to make code portable to older compilers.