PaulHoule 3 months ago

Makes me appreciate Java more.

Garbage collection is a key property of Java, JavaScript, Python and many other managed languages where you can mash 100-1000 libraries into an application and it (eventually) works. Key to that is that you don't have to think about where you get memory from or having to dispose of it later.

Consider how bad it is in C, where you'd often like to be able to have the library use a buffer from the application but possibly the library will malloc complex data structures and you'd like to be able to give it the malloc for your arena allocator. Sometimes the library does not know if the application still needs a data structure, other times the application doesn't know if the library still needs it.

I am glad the garbage collector knows! It's an example of how externalizing a concern eliminates so many concerns you'd have otherwise distributed throughout the code, and if your GC is generational you're getting much of the benefit of the arena collector.

Rust externalizes these conflicts which, as I understand it, means that libraries and applications are going to have to pick and choose particular conventions which could be a "just works" experience when things are aligned but it will get harder going if you want to bring in libraries that use different conventions.