e.g. if I allocate a callback function, and hand it to setTimeout, I have no way to know when to collect it.
Sure, you can encode rules about some of the common functions; but as soon as you get to e.g. attaching an 'onreadystatechange' to an XHR: you can't follow all the different code paths.
Every time a proposal comes up to fix this:
- GC callbacks
- Weak valued maps
- Proxy with collection trap
The proposal gets squashed.Unless this is attended to Javascript remains the required language on the web.