News for hackers. Stuff that matters.
Re:Interview with Zig language creator Andrew Kelley [video] by edflsafoiewq on Friday September 04, 2020 @05:33PM (#24379109)
The issue is with the individual elements, which get pushed to the list, popped off the list, moved around, pushed to a different list, etc.

The other issue is since there is no generic notion of a destructor, it isn't possible to write generic functions that destroy elements. If you call, say, replace_range on a list of strings, it will leak the replaced strings.

Re:Interview with Zig language creator Andrew Kelley [video] by int_19h on Monday September 07, 2020 @09:06PM (#24404277)
> The issue is with the individual elements, which get pushed to the list, popped off the list, moved around, pushed to a different list, etc.

That's separate from the destructor for the entire list. It does mean that the code that removes an element from the list has to explicitly invoke the destructor for it - which is in agreement with using "defer" to explicitly invoking destructors for locals.

> The other issue is since there is no generic notion of a destructor, it isn't possible to write generic functions that destroy elements.

But you can have a generic notion of a destructor - that's orthogonal to whether destructors are invoked explicitly. You just have an interface (or trait, or whatever it's called) that exposes a destructor method for a type.

Re:Interview with Zig language creator Andrew Kelley [video] by edflsafoiewq on Thursday September 10, 2020 @08:27PM (#24438025)
You could but Zig does not.