On Jan 8, 2019, at 3:14 PM, Brian Goetz <[email protected]> wrote: > > Essentially, you're saying that if someone declares a pattern variable that > would shadow a DU (final, please!) local, then the variables are merged and > the scope is pinned at the scope of the local. That's nice in that the scope > and declaration point are now clearer, but on the other hand the concept of > binding is now muddier: pattern variables now interact with shadowing, with > locals, and maybe get sucked into mutability too ("why not just treat binding > as ordinary local assignment".) So it plugs one leak, but opens up several > others.
True enough. But it seems that a lot of that machinery is already a sunk cost, for merging bindings in (a instanceof T t || b instanceof T t). The new thing would be putting blank (yes, implicitly final!) declarations into the mix as candidates for merging. That strikes me as a plausible bargain.
