What is the meaning of this?

Alex Buckley Alex.Buckley at Sun.COM
Thu Feb 4 13:26:37 PST 2010


Mark Mahieu wrote:
> The User Guide at http://groovy.codehaus.org/Closures says:
> 
> 	"this : as in Java, this refers to the instance of the enclosing class where a Closure is defined"
> 
> As in Java.  Well, fancy that.

For completeness on the Groovy front, note that technically 'this' is 
the closure instance, but that 'this.foo' refers to the lexically 
enclosing object ('owner') as if by magic:

http://stackoverflow.com/questions/820084/groovy-meaning-of-this-inside-a-closure

Alex


More information about the lambda-dev mailing list