[External] : Re: Guards
forax at univ-mlv.fr
forax at univ-mlv.fr
Tue Mar 9 21:45:36 UTC 2021
----- Mail original -----
> De: "John Rose" <john.r.rose at oracle.com>
> À: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "Remi Forax" <forax at univ-mlv.fr>, "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Mardi 9 Mars 2021 19:56:42
> Objet: Re: [External] : Re: Guards
> 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.
> Piling on:
> 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.
I agree that patterns have input args.
There are two kinds of input args, one is the implicit target, the others are other arguments.
It's not obvious to me that the parameters other than the target have to have access to the bindings.
I see the pattern + parameters has a partial application, i.e. the parameters other than the target are constants,
the keys of the map are constant, the java.util.regex.Pattern (or the string) of a metch is a constant, etc
So yes, a pattern have input parameters other than the target but should they have access to the bindings, i think we are loosing a lot with that model.
> 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.
> — John
More information about the amber-spec-experts