On 11-07-31 09:23 AM, Patrick Walton wrote:

So I should have been more clear -- in this scheme local variables would
be the only non-hoisted bindings. It's rare that local variables need to
be mutually recursive; the only time is when you want mutually recursive
capturing lambdas, and in that case I don't think manually hoisting is
too bad. Absent mutual recursion, I don't see any benefit to hoisting
local variables, other than (a) consistency between items and locals and
(b) simplifying the compiler implementation a bit (but note that we
actually get this wrong at the moment -- we initialize local variables
at the time we see the "let", which can cause segfaults).

Segfaults? That is surprising. What's wrong with doing what we do now (in terms of safety)?

In terms of where a variable's scope begins, at its declaration line vs. the previous brace, I'm not terribly fussy. I did it the way I did mostly for simplicity sake. Feel free to change if it bugs you.

(Also note: there *shouldn't* be any use-before-init happening in any interpretation, as we have a typestate system that should catch all that.)

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to