On 10-12-01 12:04 PM, Bob Nystrom wrote:
Anyway, hopefully that's helpful for you. Keep up the good work, I'm really
excited about the language.
Thanks. It is helpful, yes. The approach we settled on trying looks
largely like what you've outlined here; we're mostly rearranging it into
an expression language with syntax carefully ordered to behave exactly
like statements, if you choose to write that way. Assuming most people will.
Not sure if we'll try to merge reachability and typechecking a la your
proposed Never type, but it's an interesting suggestion. Might go there.
We have a little reworking of the typestate algorithm ahead to
compensate for the change to deeper exprs.
We *are* retaining a 'stmt' AST node but it'll wind up just as the
tagged union of 'decl' and 'expr'. We're not even going to parse
"a + type b = int;"
for example; decls only live at block-top level, not nested in exprs.
This is mostly just to make the scope rules maximally obvious. A decl is
in scope for the block it's declared in. I don't think it's much of a
limitation since block is an expr; you could do "a + { type b = int; };"
and mean the same thing; really it's just a rule about being unambiguous
about decl scopes.
(Dherman suggested that if you look carefully, Scheme makes this
distinction too; I haven't looked closely enough to be sure so I will
not claim it is so but I recall a distinction at compilation-unit or
module top-level in various lisps. I know Ocaml has it: note the
'definition' production in their AST :)
-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev