On 10 Mar 2021, at 00:55, Guy Steele 
<guy.ste...@oracle.com<mailto:guy.ste...@oracle.com>> wrote:



On Mar 9, 2021, at 1:47 PM, Brian Goetz 
<brian.go...@oracle.com<mailto:brian.go...@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.


Well, just to be fair, rules for flow scoping within expressions g && h already 
exist, but rules for P && g and P & Q do not yet exist.  It’s easy to see that 
they probably should exist, and that this can be done in a manner entirely 
analogous to the way flow scoping is already done in expressions, but it has 
been an implicit assumption in some of the past discussion that is worth making 
explicit.  “Consider it done!”  :-)


The draft JEP does try to be reasonably informative on this matter:

A conditional-and pattern p & q introduces the union of the pattern variables 
introduced by the patterns p and q. The scope of any pattern variable 
declaration in p includes the pattern q. (This allows for a pattern such as 
String s & true(s.length() > 1) -- a value matches this pattern if it can be 
cast to a String and that string has a length of two or more characters.)

Gavin

Reply via email to