Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They didn't steal it completely since it doesn't happen automatically. You can still forget to clean up and leak files or threads or what have you.

I continue to be disappointed that only Rust and C++ have automatic destruction. People already regularly forget to use Java's try with resources or Python's with, or Go's defer.

Isn't the point of computers that they can remember stuff for us? Everyone agrees automatic cleanup is the way to go for memory but not any other kind of resource?



RAII doesn't work with a (non-refcounting) GC is the issue: when the scope ends, you've no idea how many references there are and which of these are live.

With static typing you could opt into affine or linear types and those could get special cased by the compiler (to ensure a single reference is possible, and trigger the drop in case of affine types), but first you do need static typing (that's not javascript), and then you need to update the entire language to correctly handle the new affine or linear behaviour.

And that can lead to a lot of weird shit with languages not designed for that (especially linear typing).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: