On 26.06.20 18:02, OCsite wrote:

On 26 Jun 2020, at 17:46, Daniil Ovchinnikov
<daniil.ovchinni...@jetbrains.com
<mailto:daniil.ovchinni...@jetbrains.com>> wrote:
when located within "getX()", "isX()" or "setX()"
I think the meaning of an expression must not depend on the context.

Note currently it does, actually :) Based on context, in today's Groovy,
/this.foo/ might be compiled either as /this.getFoo()/ or as /this.@foo/
— which I argue is wrong and should be cleaned up :) IMO, /this.foo/
should be always compiled as /this.getFoo()/. If someone wants
/this.@foo/, it is really very easy to write the one small '@'. And it
is intention-revealing and makes it the code intuitively understandable,
which are very good traits.

But that is not how property access in general works in Groovy. if you
have foo.bar, then (not considering the specialities of the MOP) this
calls getBar(), but only if getBar() exists. if there is an accessible
(not Java accessible) field bar, then we access the field. If we go
strictly by foo.bar means foo.getBar(), it would mean the call must fail
if there is no getter for bar.

bye Jochen

Reply via email to