5 ms·
What do you mean by memory safe? This line is trotted out all the time but no one defines what they actually mean. Is Go memory safe? Rust is not a "memory safe
by flumpcakes 4y ago
What do you mean by memory safe? This line is trotted out all the time but no one defines what they actually mean. Is Go memory safe? Rust is not a "memory safe" panacea. You can write memory unsafe code in Rust.
Zig also has a much better developer experience around "memory safety" compared to C/C++. It really is an interesting alternative to writing something in C. You can compile it in debug mode and get out of bounds checks, for example.
- KerrAvon 4y agoRust is, in fact, a "memory safe" panacea if you're willing to put up with the syntax and complexity. Memory unsafe code in Rust is clearly marked as such, and you have to go out of your way to write it. Swift is similarly memory safe out of the box. By contrast, it seems to be trivial to write unsafe code in Zig. https://www.scattered-thoughts.net/writing/how-safe-is-zig/ https://www.scattered-thoughts.net/writing/how-safe-is-zig/ The window has closed for languages that don't take memory safety seriously. The Zig team can work on it now, or they can work on it later, but they will have to do it to get the language past a certain level of adoption in the modern world. People are starting to write real, useful Linux kernel modules in Rust.
- BaculumMeumEst 4y ago> The Zig team can work on it now, or they can work on it later, but they will have to do it to get the language past a certain level of adoption in the modern world. The objective of every language does not have to be world domination.
- pcwalton 4y agoUBSan has offered bounds checking support for C/C++ for a long time.
- pjmlp 4y agoZig doesn't offer much more than what Modula-2 was already doing in 1978, and memory debuggers exist for C and C++ for about 25 years now. One my first ones was Purify. https://en.wikipedia.org/wiki/PurifyPlus https://en.wikipedia.org/wiki/PurifyPlus
- cyber_kinetist 4y agoDid Modula-2 had the range of compile-time metaprogramming facilities that Zig has (and is obviously a big part of the language design?)
- pjmlp 4y agoThat is the only thing that Zig offers over Modula-2, which without an ecosystem is hardly worth of change, when it is just as safe as C and C++. Also probably the only language that is able to beat Objective-C in the amount of @ per line of code.