[External] : Re: Proposal: java.lang.runtime.Carrier
forax at univ-mlv.fr
forax at univ-mlv.fr
Thu Mar 3 18:42:01 UTC 2022
> From: "Brian Goetz" <brian.goetz at oracle.com>
> To: "Remi Forax" <forax at univ-mlv.fr>, "Jim Laskey" <james.laskey at oracle.com>
> Cc: "amber-spec-experts" <amber-spec-experts at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20220303/a528cdfd/attachment.htm>
More information about the amber-spec-experts
mailing list