7 ms·
I think it's more subtle than that. Rust has a notion of non-lexical lifetimes (https://rust-lang.github.io/rfcs/2094-nll.html https://rust-lang.github.io/rfcs/
by sgeisenh 3y ago
I think it's more subtle than that. Rust has a notion of non-lexical lifetimes (https://rust-lang.github.io/rfcs/2094-nll.html https://rust-lang.github.io/rfcs/2094-nll.html) and the compiler often completely avoids the use of the stack for small, trivially droppable values, regardless of their lexical scope. In some ways, `let` in Rust is a more C-like variant of the `let ... in ... end` construct from OCaml.
Not to mention that you can always introduce a new lexical scope with `{ ... }` in Rust code.
- User23 3y agoI believe there are Common Lisp implementations that will happily stack allocate dynamic extent values.