what if:
if (foo.bar != null) {
baz() // may set bar to null
const y = foo.bar.length; // is this still fine ?!?!
}
or what if bar is a weak variable that can go away after check? does the check itself make it strong? would be very confusing if the first "if" proceeds and the second doesn't (should the weak bar be gone between ifs):
if foo.bar != nil {
// weak bar here is used as strong
}
if foo.bar != nil { // and here weak bar is nil
// so this doesn't run
}
user who happens to do a refactoring here might remove the second "if" and move both branches under the single if, but that would mean a behaviour change (the second branch will always execute compared to the original version) which is very easy to miss.
if var/let x = xxx solves all this different cases (rename v not rename, ability to either continue using the original optional value or override it, weak/strong vars, var vs let). nothing is broken here to be fixed.