[External] : Re: Two new draft pattern matching JEPs

Brian Goetz brian.goetz at oracle.com
Sat Mar 6 17:52:56 UTC 2021


On reflection, I think this is just something we have to trust users to 
do responsibly; use parentheses, newlines, and indentation to make their 
code clear.

On 3/5/2021 7:11 PM, John Rose wrote:
> On Mar 4, 2021, at 8:28 AM, Brian Goetz <brian.goetz at oracle.com 
> <mailto:brian.goetz at oracle.com>> wrote:
>>
>> A lot of people (initially, me included) would like to just interpret 
>> a boolean expression as a pattern:
>>
>>     case Foo(var x, var y) && x > y: ...
>>
>> I found that goal compelling, but as patterns get more complicated, 
>> this gets unreadable.  A main benefit of the true() patterns (or, the 
>> explicit guard() pattern declared above) is that it "quarantines" the 
>> expression in an expression wrapper; there's a clear boundary between 
>> "pattern world" and "expression world”.
>
> Yes, this is the stubborn root cause we are working around.
>
>
>

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


More information about the amber-spec-experts mailing list