groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Johnson <john...@cs.uiuc.edu>
Subject change in definition of Groovy?
Date Tue, 17 Nov 2015 19:04:45 GMT
I am in the process of converting a large Groovy program from 2.1 to 2.4.
A year or two ago I converted it from (I think) 1.8 to 2.1.

I found an odd assignment.

obj.foo?.fee = v

The code assumed that if obj.foo was null, this assignment statement was
skipped.   It does not work that way in 2.4, and I had to rewrite it to
make the code work.  I had no idea that you could use the safe
dereferencing operator on the left-hand-side of an assignment, I always
thought it was only on the right-hand-side.   I imagine that the author of
this code was exploiting a bug in Groovy, that Groovy was never supposed to
allow this.   Somewhere between 2.1 and 2.4, this bug got fixed.    Or was
there a change in the definition of Groovy?   Or am I completely missing
the point?

-Ralph Johnson

Mime
View raw message