This is at the JavaScript level but I would love to see someone release a browser with a side-by-side JS VM and Lua VM, just as an experiment to what the web could be like with a better language.
Foe anyone interested, there was a port of Webkit/Blink where the web objects retained by javascript are garbage collected outside of V8, using blink GC to destroy those objects.
The way it works its through smart pointers, where for instance you say how the reference to that object is retained according to the object that it references.
The good side of this is that other programming languages besides Javascript can deal with blink objects the same way Javascript does (This feature was called 'oilpan').
It's this feature that makes possible for my project to have web-based applications in Swift, for instance, and would allow to plugin the Lua VM or Jit in the same way and still be able to be a first-class citizen of the webkit API as Javascript is.
It's there. For instance if you want to retain a reference to a 'WebFrame' for instance, you can create a wrapper object which is the one you directly control the lifetime and have a 'Persistent<WebFrame>' as a property of your wrapper to hold the blink reference.
As long the smart pointer is not destroyed (with the destruction of your wrapper or holder) the web frame object is guaranteed to retain a reference, making the object alive.
Otherwise you can retain Weak<> and Member<> smart pointers for things that your object dont own, and of course, in the case of Weak<> you can expect it to be collected in the next scheduled GC job (or anytime). And in the case of Member<> is not a strong reference to the object as in Persistent<> so you dont own the object's lifetime, but you retain a reference so the object should not go away while you hold it.
To see how serious is the commitment to this scheme, you can just explore the Blink codebase to see that this scheme is
actually used internally as a way to control lifetime between objects, and not just as a API thing to be used from consumer projects (unlike V8 which vends a different API for consumers of the VM from the one it uses internally).
https://www.cnet.com/news/googles-dart-language-arrives-in-c...
and they cancelled it ... my interpretation of their reasons are unless all browsers ship it it's a problem.
https://news.dartlang.org/2015/03/dart-for-entire-web.html