[External] : Re: Guards

forax at univ-mlv.fr forax at univ-mlv.fr
Tue Mar 9 22:57:15 UTC 2021

> De: "John Rose" <john.r.rose at oracle.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "Brian Goetz" <brian.goetz at oracle.com>, "amber-spec-experts"
> <amber-spec-experts at openjdk.java.net>
> Envoyé: Mardi 9 Mars 2021 23:05:28
> Objet: Re: [External] : Re: Guards

> On Mar 9, 2021, at 1:45 PM, [ mailto:forax at univ-mlv.fr | forax at univ-mlv.fr ]
> wrote:

>> 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.

> If I read you correctly, you want patterns to be
> as statically scrutable as possible, so that translation
> strategies can boil together as much of the pattern
> as possible before first execution, typically using
> indy or condy to do “advanced” configuration
> and optimization of statement logic.

Not for the translation strategy, just to be able to rapidly read all the patterns without having to precisely follow the control flow. 
I would like to have the horizontal reading to be as simple as possible so you can grasp the whole pattern matching vertically. 
Another way to see it is to see Pattern as declarations more than expressions. 

> Moreover, I think you want patterns to *reject*
> non-constant operands, so that such configurations
> are reliably done before first execution.

> I whole-heartedly agree with the first goal,
> but I think the second would be a bridge too
> far, because various kinds of refactorings
> can shift expressions in and out of the
> “constant” category, and that’s useful.

yes, it's not "constant" for the language. 
It's morally constant, the same way the lambdas in a stream has to be side effect free. 


> — John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210309/9539a834/attachment.htm>

More information about the amber-spec-experts mailing list