Re:Why Zig when there is already C++, D, and Rust?
by creata on Friday January 15, 2021 @07:59PM
(#25798791)
On the other hand, what does Zig lose that C++ has? I've seen that it doesn't have destructors. Does it have some other means of ensuring that I'm closing my resources appropriately, or am I burdened with ensuring that myself? After all, memory safety is just one kind of resource safety.
[ Parent
| on HN ]
Re:Why Zig when there is already C++, D, and Rust?
by dralley on Friday January 15, 2021 @09:00PM
(#25799191)
It has "defer" and "errdefer" constructs for cleaning up resources, comparable to Go, but obviously applying to more things since there's no GC.
Re:Why Zig when there is already C++, D, and Rust?
by pron on Saturday January 16, 2021 @06:11AM
(#25801533)
AFAICT, it loses absolutely nothing. It does reject C++'s
implicitness, so it replaces destructors with an explicit defer, but the mechanism is pretty much the same. That it does all this in a language you can fully learn in a day or two is remarkable.