4 ms·
You could do escape analysis equivalent to Rust's only if you inlined all the functions. Sometimes, that's simply not possible, e.g. with separate compilation.
by tomp 12y ago
You could do escape analysis equivalent to Rust's only if you inlined all the functions. Sometimes, that's simply not possible, e.g. with separate compilation.
On the other hand, Rust is still able to perform its kind of escape analysis (via lifetime-tracking type system), because the relevant facts are embedded in type signatures of Rust functions, and as such must be present even for separate compilation (even if the actual implementation of the function is unknown).
- pkolaczk 12y agoVM could do see all the functions and do whole-program analysis. Inlining is an orthogonal concept.
- pcwalton 12y agoYou could in theory, but that analysis would likely be really slow. In any case, without the type system and compiler to enforce the discipline the programmer is going to lose a lot of control and predictability.