Possible records tweak
daniel.smith at oracle.com
Mon Apr 27 22:55:01 UTC 2020
> On Apr 27, 2020, at 4:37 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>>> So maybe `super` is DA but `this` is DU, just like in the code
>>> before the super-constructor call. (I’m abusing the terms DA/DU
>>> like Brian is, and you call out, but they are close to correct.)
>> I think this means I can't call inherited method 'getParentWidget()' or some static utility 'computeWidgetOfParent(this)' method (e.g., 'identityHashCode(this)'). I *can* call 'super.getParentWidget()'.
> Except records only inherit from Record, which has no non-inherited instance methods.
Yes, this is in the context of: what if we have, say, abstract super-records some day? Now there are really good use cases for wanting access to some members of 'this'.
The usual argument that we could always relax the constraint later works here, although once there's a precedent, it may be hard to say "just kidding, use 'this' however you like!"
More information about the amber-spec-experts