blackdrag commented on PR #3331:
URL: https://github.com/apache/groovy/pull/3331#issuecomment-7345790827
I disagree with the approach. There is a difference between `this.foo()` and
`foo()`. The later is using an implicit this, as I call it. And for the
implicit case it is in general not fully clear what it means without context.
And some of the context is runtime information. So for example in a simple
class `this.foo()` and `foo()` are equal in the sense that if the class has no
method foo(), that the call fails/goes to MOP way. if The same code is in an
inner class and the inner class does not define foo(), but the outer class
does, then `this.foo()` is not supposed to resolve against the outer class at
all. For `foo()` it is expected. In case of a Closure block `this` means the
class the block is defined in. So a `this.foo()` in such a block in the Inner
class case will resolve against the inner class, not the outer. `foo()` on the
other hand participates in dispatch like any other method inside a Closure does
and may be resolved against a delegate for example. Or it might be res
olved against "thisObject", which is the inner class and in that case we may
want to propagate to the outer class as well.
That means `void plusAssign(In other) { other[2] }` cannot resolve to getAt
in Outer. Same for Deep
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]