3 ms·
I'd be very worried about accidental shadowing. x = 4 if (cond) { x = 8 log("x is now: ", x) } process(x) Looks right, but it'
by tedunangst 5y ago
I'd be very worried about accidental shadowing.
x = 4
if (cond) {
x = 8
log("x is now: ", x)
}
process(x)
Looks right, but it's wrong.
- verdagon 5y agoFortunately, the Vale compiler doesn't allow shadowing. It also says "Did you forget the set keyword?" in case they meant to modify x.
- renox 5y agoI'm surprised: in Rust they allow variable shadowing because otherwise with the 'immutable by default' design they thought that you'd have to create too many names. Isn't it an issue for Vale?