3 ms·
The confusion with `let` and `var` does seem confusing from a JS perspective, but it seems to be so that you can have the same mental model between WGSL and SPI
by lainga 5y ago
The confusion with `let` and `var` does seem confusing from a JS perspective, but it seems to be so that you can have the same mental model between WGSL and SPIR-V:
https://github.com/gpuweb/gpuweb/issues/2207 https://github.com/gpuweb/gpuweb/issues/2207
- devit 5y agoIt seems to be a syntax mismash between Rust, which uses `let` and `let mut`, and JavaScript, which uses `const` and `var`, giving WGSL's `let` and `var`, probably chosen because they are the shortest.
- djxfade 5y agoJavascript also has `let`. It's basically like var, but doesn't get hoisted. And can't be unassigned once assigned.