Flow scoping
John Rose
john.r.rose at oracle.com
Tue Jan 8 23:42:28 UTC 2019
On Jan 8, 2019, at 3:14 PM, Brian Goetz <brian.goetz at oracle.com> 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.
More information about the amber-spec-experts
mailing list