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?

Reply via email to