3 ms·
> The runtime can figure out heap vs stack. Progressively better over time. Definitely better than I can do. Not really true: when you get into higher order co
by pcwalton 13y ago
> The runtime can figure out heap vs stack. Progressively better over time. Definitely better than I can do.
Not really true: when you get into higher order control flow it's a huge mess and usually escape analysis falls down. The Rust lifetime system allows stack allocation to a greater extent than any escape analysis system I know of.
That said, we've thought about doing escape analysis, but usually you don't need it in Rust: people reach for the garbage collector only when it's absolutely needed anyway, so having the compiler promote GC allocations to stack allocations automatically would only help in a tiny fraction of cases.