Different handing of "this" vs. "MyClass.this" in definite assignment
Archie Cobbs
archie.cobbs at gmail.com
Thu Dec 1 21:29:18 UTC 2022
On Thu, Dec 1, 2022 at 1:03 PM Brian Goetz <brian.goetz at oracle.com> wrote:
> To come up with a sensible meaning of option (2), I think we have to
> assess the spec impact of threading the equivalence of `[implicit C].this`
> and `C.this` through the spec?
>
I think it depends on how ambitious you want to be.
At its narrowest, this issue is not about the equivalence of "MyClass.this"
and "this", it's about the equivalence of "MyClass.this.foo" and
"this.foo", and only as that relates to definite assignment, i.e., it's
about the definition of the phrase "access to its value" in the first two
sentences of JLS §16. And of course this definition is a lexical one, not a
semantic one.
I agree it would be nicer if the entire JLS were refactored to make
"MyClass.this" and "this" always mean the same thing (only when "this" has
type MyClass of course), but that's a bigger change than is strictly
necessary here. And I'm fuzzier on what that would even mean... what other
sections are there besides §16 that talk about "this" and/or "MyClass.this"
in lexical terms instead of in terms of the object reference that they
represent? I'm not familiar enough to know if there even are any, or which
sections they are, off the top of my head.
-Archie
--
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20221201/0ae5a03c/attachment.htm>
More information about the amber-dev
mailing list