News for hackers. Stuff that matters.
Re:Zig self hosted compiler is now capable of building itself by zigger69 on Saturday April 16, 2022 @05:59PM (#31056471)
It's really easy in Zig to be honest. Just put `defer thing.deinit()` in the right scope and you're done. You gain explicitness and know exactly what's going on in your Code. Everything is obvious. That's the reason Zig is so incredible simple and easy to read. Zig also has a GPA that will tell you about memory leaks or anything.
Re:Zig self hosted compiler is now capable of building itself by puffoflogic on Saturday April 16, 2022 @07:04PM (#31056888)
And in rust you just put `` in the right scope and you're done. This is perfectly explicit and you know exactly what's going on in your code. Everything is obvious.
Re:Zig self hosted compiler is now capable of building itself by zigger69 on Sunday April 17, 2022 @08:21AM (#31060352)
You can execute arbitrary code on drop operations by implementing `std::ops::Drop` for a type.
Re:Zig self hosted compiler is now capable of building itself by pornel on Monday April 18, 2022 @10:00PM (#31079078)
A `.deinit()` function could also run some arbitrary code that does weird and unexpected things. The point is that reasonable people don't abuse functions like that — if they do abuse, don't use their code. Neither Rust nor Zig is a sandbox that could stop actively stupid/malicious code.
Re:Zig self hosted compiler is now capable of building itself by dralley on Saturday April 16, 2022 @11:15PM (#31058144)
Rust's ownership rules are no less explicit. The object dies when the owner of the data goes out of scope.