JEP-468: Derived record creation in record methods with parameter
Eirik Bjørsnøs
eirbjo at gmail.com
Tue Apr 30 06:41:27 UTC 2024
On Tue, Apr 30, 2024 at 8:13 AM Eirik Bjørsnøs <eirbjo at gmail.com> wrote:
> Complex withReal(double re) { return this with { this.re = re; }; }
>
>
Although perhaps it would be strange if "this" refers to the origin record
in the origin expression, then switches to refer to the derived record in
the transformation statement?
In a plain old setter, we could use "this.re = re" as an escape hatch to
avoid shadowing of parameters, but if "this doesn't work like that" inside
a transformation block, perhaps our only way out is to rename
parameters/locals to avoid shadowing?
Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240430/1bc0e2a7/attachment-0001.htm>
More information about the amber-dev
mailing list