brain
brain copied to clipboard
Declaration without initialization
Sometimes it's useful to declare a variable first and then initialize it later. The syntax for that would be something like what follows:
// declaration only cannot have an unspecified width
let a: [u8; 5];
a = "12345";
- [ ] appropriate static checking to ensure that variables cannot be used uninitialized. (particularly with branches and loops)
- [ ] Allocation occurs on initialization, not on declaration (so we don't allocate needlessly)
- [ ] lint for when a variable is declared but never used, initialized but never used, or updated and then never used
This was mostly implemented in PR #34. The syntax is stable, though the static checking still needs work.
This may get prioritized until after MVP.