> From: "Brian Goetz" <brian.go...@oracle.com>
> To: "Remi Forax" <fo...@univ-mlv.fr>, "Jim Laskey" <james.las...@oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts@openjdk.java.net>
> Sent: Thursday, March 3, 2022 7:29:21 PM
> Subject: Re: [External] : Re: Proposal: java.lang.runtime.Carrier

>> For the pattern matching,
>> we also need a 'with' method, that return a method handle that takes a 
>> carrier
>> and a value and return a new carrier with the component value updated.

> It is not clear to me why we "need" this. Rather than jumping right to "Here 
> is
> the solution", can you instead try to shine some light on the problem you are
> trying to solve?
When you have nested record patterns, each of these patterns contribute to 
introduce bindings, so when executing the code of the pattern matching, the 
code that match a nested pattern needs to add values into the carrier object. 
Given that the Carrier API is non mutable, we need the equivalent of a 
functional setter, a wither. 

Rémi 

Reply via email to