[External] : Re: Proposal: java.lang.runtime.Carrier

Brian Goetz brian.goetz at oracle.com
Fri Mar 4 02:11:44 UTC 2022


>
>     Either way, we don't need to mutate or replace carriers. 
>
>
> You want the same carrier for the whole pattern matching:

I think you're going about this backwards.  You seem to have a clear 
picture of how pattern matching "should" be translated.  If so, you 
should share!  Maybe your way is better.  But you keep making statements 
like "we need" and "we want" without explaining why.

> - if you have a logical OR between patterns (not something in the 
> current Java spec but Python, C# or clojure core.match have it so we 
> may want to add an OR in the future)

OR combinators are a good point, but they can be done without a with 
operation.

> - if different cases starts with the same prefix of patterns, so you 
> don't have to re-execute the de-constructors/pattern methods of the 
> prefix several times

Agree that optimizing away multiple invocations is good, but again, I 
don't see that as being coupled to the pseudo-mutability of the carrier.


Perhaps you should start with how you see translation working?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220303/51a2d7b4/attachment.htm>


More information about the amber-spec-experts mailing list