5 ms·
Interesting. I had the impression Zig proponents were praising it because it wasn't as low-level as Rust.
by k__ 5y ago
Interesting.
I had the impression Zig proponents were praising it because it wasn't as low-level as Rust.
- klyrs 5y agoQuite the opposite. The very broad-brush overview is that zig aims to replace C and rust aims to replace C++... but among other issues with that analogy, that can't happen unless zig and rust have a dead-simple integration story.
- dagmx 5y agoI've only ever really seen it in Zig communities that Rust is closer to C++ In Rust communities, it's often pitched as alternates to both, but closer to C. I suppose it's all relative, but the comparison of rust to c++ seems external
- k__ 5y agoYes, I also had the impression Rust is a C replacement.
- mst 5y agoI sort of look at it as aiming at the spot where you could write the code in C with a sprinkle of C++ features and whether to add that sprinkle or do things like hand-rolling a vtable system where you need one is a decision that will vary depending on circumstances. Though I believe the mozilla code it's replaced was all -very- C++.
- eximius 5y agoFrom a programming language design space, it's much more like C++. However it can occupy some niches that C can but C++ does poorly because of zero cost abstractions, I think. (Very handwavy)
- ncmncm 5y agoThere are no niches where Rust can do better than C++. In many places Rust can, uniquely, match C++.
- jibalt 5y agoThis is of course false.
- tialaramex 5y agoDe gustibus non est disputandum, and thus at such a high level of abstraction you are at best trolling.
- ncmncm 5y agoThe first person to mention trolling is invariably the troll.
- ncmncm 5y agoRust's purpose, its whole reason to exist, is to displace C. Rust will unavoidably fail in that, because anybody still using C is not willing to learn anything else: anybody willing to move on from C already did, long ago. Rust is already approaching C++ in complexity, surpassing it in some places; and also in expressive power, but not surpassing it anywhere yet. If Rust does not end up fizzling (which is still very possible!), Rust programmers will generally be drawn from the same population as C++ programmers. They will be people who want and can use a powerful language to make themselves more productive and able to manage bigger projects, without need to worry that they are taking a performance penalty, or losing control of details that matter. Users of Zig, like of Nim and C, will be those uncomfortable with language power, disinclined to automate. Their attention is not on software and what they can build of it, but on problems where a thin veneer of software can add something useful. When there is not much for the software to do, you don't need much power to get it doing that.
- deleted 5y ago[deleted]
- pjmlp 5y agoEven if the only success story for Rust would be mainstream adoption of lifetime checkers across languages to some extent, that would already be a victory as it managed to change the baseline of language design across the industry. A subject that now has become even regular presence at C++ conferences and considered a must have in static analysers roadmap by all major vendors. Rust might fizzle out in a decade, and still leave such a mark in the industry.
- ncmncm 5y agoI have not heard of a lifetime checker in any other language, except maybe Midori.
- pjmlp 5y agoSo here is a sample, Chapel, HPC language mostly sponsored by Intel and HPC https://chapel-lang.org/ https://chapel-lang.org/ D programming language, https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in-d/ https://dlang.org/blog/2019/07/15/ownership-and-borrowing-in... Ada/SPARK, https://docs.adacore.com/spark2014-docs/html/ug/en/source/language_restrictions.html#memory-ownership-policy https://docs.adacore.com/spark2014-docs/html/ug/en/source/la... Swift, https://github.com/apple/swift/blob/main/docs/OwnershipManifesto.md https://github.com/apple/swift/blob/main/docs/OwnershipManif... ParaSail http://www.parasail-lang.org/ http://www.parasail-lang.org/ Project Verona from Microsoft Research https://www.microsoft.com/en-us/research/project/project-verona/ https://www.microsoft.com/en-us/research/project/project-ver... Project Snowflake from Microsoft Research https://www.microsoft.com/en-us/research/publication/project-snowflake-non-blocking-safe-manual-memory-management-net/ https://www.microsoft.com/en-us/research/publication/project... And finally your favourite C++ "Implementing the C++ Core Guidelines’ Lifetime Safety Profile in Clang" https://llvm.org/devmtg/2019-04/slides/TechTalk-Horvath-Implementing_the_C++_Core_Guidelines_Lifetime.pdf https://llvm.org/devmtg/2019-04/slides/TechTalk-Horvath-Impl... Also the "Clang Static Analyzer - A Tryst with Smart Pointers" talk at 2021 LLVM Developers Meeting. For the Visual C++ part of the story https://devblogs.microsoft.com/cppblog/lifetime-profile-update-in-visual-studio-2019-preview-2/ https://devblogs.microsoft.com/cppblog/lifetime-profile-upda... And GCC as well, although they are late to the party https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer https://gcc.gnu.org/wiki/DavidMalcolm/StaticAnalyzer Finally a couple of CppCon 2021 talks that touch on the subject in various ways, Type-and-resource safety in modern C++ Code Analysis++ Static Analysis and Program Safety in C++: Making it Real Finding Bugs Using Path-Sensitive Static Analysis
- elteto 5y agoI think it is a C++ replacement that is _closer_ to C. It has generics, traits, RAII, etc, which are C++, not C, features but the way that Rust implements them _feels_ closer to C. I don't know if this quite makes sense but as an external observer this is my impression.
- pasabagi 5y agoI don't really understand how Rust could be compared to C. Rust is perhaps more austere than C++, but that's like saying the neptune is smaller than jupiter. It's still a big language with a generous standard library. You almost never do everything yourself, by hand, which is the hallmark of the C experience. Just compare the list of methods rust has for a &str, compared to the fact C doesn't have a string type, to see the gulf of cultural difference. Obviously, C and Rust are both low-level languages (in terms of control and overhead), but there are quite a few of those.
- nix23 5y ago>>Feature Highlights Small, simple language >>There is no hidden control flow, no hidden memory allocations, no preprocessor, and no macros. https://ziglang.org/learn/overview/ https://ziglang.org/learn/overview/ It try's (achieves?) to be a C without the flaws and historic ballast.
- jibalt 5y agoWhere did you get that impression? No one has ever done that.
- k__ 5y agoHere at HN. I never read anything about Zig outside of HN. What I remember was mostly that Zig should be easier to use than Rust, because Zig doesn't have lifetimes.
- jibalt 5y agoThat doesn't make Zig higher level than Rust. It doesn't have lifetimes because it's low level, on a par with C ... all memory management is manual and you can abuse pointers to your heart's content.