Possible records tweak
Dan Smith
daniel.smith at oracle.com
Fri Apr 24 19:45:46 UTC 2020
> On Apr 24, 2020, at 1:40 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
>
>> I wouldn't suggest a syntactic restriction on 'this'—that's a brittle way to try to provide guarantees about not leaking the object being instantiated. (What about the entities in scope? What about 'super'? What about inner class instantiations? It's whack-a-mole.)
> What if we said that `this` were DU in the entire body of the compact ctor, just as it is before the this/super call? This would obviate the need to create yet another model (like static, but not quite), and instead would keep you from depending on `this`.
I understand what you mean, but it doesn't work like that. "'this' is DU" is handled by the spec as "you're in a static context". Many operations that morally make use of 'this' don't actually talk about it as if it were a variable.
More information about the amber-spec-experts
mailing list