Comments on JDK-8198408 please ?
scolebourne at joda.org
Tue Feb 27 10:20:07 UTC 2018
On 26 February 2018 at 21:46, John Rose <john.r.rose at oracle.com> wrote:
> Even if we support single-level field assignment (as twisted sugar for
> withfield) we should *not* support multiple-level field assignment.
> In fact, I'm doubting (again, after several years) the wisdom of allowing
> even the single-level x.a = 11. It seems to lead the user model into a
> swamp. And also contains a paradox, that a subexpression on the LHS
> of an assignment gets modified, in addition to the whole LHS.
I think having a.x = 11 "modify" a would be a poor choice. My
preferred approach is something more like this:
a = a.with(x = 11);
where multiple fields can be set:
a = a.with(x = 11, y = 12);
And potentially this could be multi-level:
eg. instead of d.c.b.a.x = 11;
d = d.with(c.b.a.x = 11);
No doubt the solution adopted for values would be similar to that for
More information about the valhalla-dev