I know what it is and why it's there! But why should it be? Why can't such programming languages clear a value from memory once it goes out of scope? Why have a background garbage collector when it's implications are known? Why not be like Rust?
Because people don't want to deal with lifetimes. Let's be honest, I love Rust, but dealing with borrows and lifetimes does take extra work.
Fast performance is not the only reason Rust has lifetimes
Ownership and lifetimes are also what makes concurrency in Rust safe, which is arguably a bigger accomplishment than memory safety (which was already solved by GC).
Having a single owner also makes it much easier to reason about who can change data. Even without threads of races.
Real-time performance, i.e. the GC does not freeze the program, so it can keep responding (e.g. in robotics).
RAII: resources like file handles etc can be cleaned up immediately, so objects can be used to wrap/represent them. This is problematic in e.g. Java, because you never know when an object is really going to be freed (so finally is used there).
With a GC, allocation can be very fast: just put everything at the next empty position, no need to search empty spaces. Allocation can be fairly slow in the worst case for e.g. C++.
Freeing a value doesn't take any time at all (there is the GC time, but it need not increase if there are more unused values).
GCs can compact the memory, which may give better cache locality.
(Also note that, in the question, 'background' suggests that garbage collectors run while the program is running, which often isn't the case.)
I think more languages will include ownership / lifetimes in the future, but I suspect they'll be languages designed for huge projects developed by big teams where every guarantee is useful to understand other people's code. I don't think it will make much sense in languages mostly used for scripts and prototyping, in the same way that static typing isn't worth the overhead at that scale.
I agree with it being a lot of work! I've just started learning Rust and boy! The idea of values changing variables because another borrows it strikes me since I've always used garbage collected languages. And yeah! Freeing values with GC isn't that bad. It's not even obvious it's there. Ah Ha ๐! Thanks!
Because people don't want to deal with lifetimes. Let's be honest, I love Rust, but dealing with borrows and lifetimes does take extra work.
Fast performance is not the only reason Rust has lifetimes
Note that GC isn't always slower than manual memory management. E.g.:
(Also note that, in the question, 'background' suggests that garbage collectors run while the program is running, which often isn't the case.)
I think more languages will include ownership / lifetimes in the future, but I suspect they'll be languages designed for huge projects developed by big teams where every guarantee is useful to understand other people's code. I don't think it will make much sense in languages mostly used for scripts and prototyping, in the same way that static typing isn't worth the overhead at that scale.