[External] : Re: Guards
john.r.rose at oracle.com
Tue Mar 9 18:56:42 UTC 2021
On Mar 9, 2021, at 10:47 AM, Brian Goetz <brian.goetz at oracle.com> wrote:
>> Apart from what have said about letting grobble to fully access to the bindings
> Except that argument doesn't make sense. Accessing the bindings is not a special behavior of grobble, but a natural consequence of flow scoping. If I have P && g (or P & grobble(g)), then the scoping rules will tell us that the true set of P is present in g, and we're done. Nothing special here.
If patterns ever have in-args (in addition to out-args,
and they will!), then flow-scoping, regularly applied,
will allow those in-args to access previously bound
out-args to the left, within the same compound pattern,
whether in an instanceof pattern or a case label pattern.
And, guards (whether built-in && as I claim they
should be) or a privileged use of in-args on a standard
method, will naturally have access to those same
leftward out-arg bindings.
I think it’s a great model. The reason we are agonizing
here is kind of artificial, because in-args in patterns
are a 99.99% probable future, of which guards are
the first manifestation.
More information about the amber-spec-experts