Re:I am not yet ready to switch to Zig from Rust
by notfed on Friday June 14, 2024 @12:13PM
(#40682086)
Well said. Though it'd be sorta neat IMO if we could use just one language here, and the memory unsafe aspect could somehow be toggled off or on, gaining all the pros or cons of Zig vs Rust as needed.
[ Parent
| on HN ]
Re:I am not yet ready to switch to Zig from Rust
by lolinder on Friday June 14, 2024 @12:27PM
(#40682218)
Are you thinking of something different than Rust's `unsafe`?
Re:I am not yet ready to switch to Zig from Rust
by cletus on Friday June 14, 2024 @12:39PM
(#40682321)
What you're talking about here is disabling runtime assertions, which is a common practice in C/C++ (using #define macros). Runtime assertions are strictly inferior to Rust's compile-time assertions because Rust allows you to do a subset of what you can do in C/C++ but it verifies that the memory ownership is correct without a runtime cost, unsafe code notwithstanding).
There simply is no way you could do that in C/C++ (and, by extension, Zig) because of the legacy support.
I'm fine with having multiple languages. One language to rule them all just tends to mean something is mediocre at everything.