Java 14 records canonical constructor
Christian Beikov
christian.beikov at gmail.com
Thu Jun 4 18:49:18 UTC 2020
Am 04.06.2020 um 20:43 schrieb Kevin Bourrillion:
> (Pedantic guy speaks: we should say /reassigning/ the parameter
> variables, not /mutating/ them, which is a different thing we could do
> if the parameters are of mutable types.)
>
> There's nothing wrong with idempotently transforming record data to a
> canonical form on its way in.
Right, when the transformation is idempotent it's all fine. I just fear
the bugs that happen because of accidental non-idempotent
transformations. I don't know how this property of records, that `new
UserRecord(id, name).equals(new UserRecord(id, name))` should always be
true, is going to be utilized by the language, but if such a
re-construction from component state happens behind the scenes this
might be a source for bugs.
More information about the amber-dev
mailing list