groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krzysztof Kowalczyk <>
Subject Re: Closure does not see field when setting value
Date Tue, 08 Nov 2016 21:21:52 GMT
Ok, thanks.

So that would make this.x reference works as expected but still x = 1 would
work in surprising way. Why to allow creation of new bindings in this way
at all? Reading bindings, fine, but creating new? To share them with
outside world?

The behaviour is surprising to me in 2 ways:
First, I do create a new thing even though it "exists".
Second, if I compile it in static way it will behave differently.

@CompileStatic should behave as I want (I guess), but I can't easily apply
@CompileStatic to a script, can I?


View this message in context:
Sent from the Groovy Users mailing list archive at
View raw message