brain icon indicating copy to clipboard operation
brain copied to clipboard

Declaration without initialization

Open sunjay opened this issue 8 years ago • 1 comments

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

sunjay avatar Jan 19 '17 05:01 sunjay

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.

sunjay avatar Feb 26 '17 01:02 sunjay