What is the meaning of this?

Mark Mahieu markmahieu at googlemail.com
Fri Jan 29 09:42:50 PST 2010


On 29 Jan 2010, at 17:39, Stefan Schulz wrote:

> Am 29.01.2010 18:34, schrieb Stefan Schulz:
>>> I don't know what the meaning of "this" is in a Groovy lambda.  Does
>>> anyone here know?
>> 
>>   From the Groovy definition:
>> "Closures always have a return value. The value may be specified via one
>> or more explicit return statement in the closure body, or as the value
>> of the last executed statement if return is not explicitly specified."
> 
> I was so focused on returns, that I missed the point of the question. I 
> did not see anything about closures and the use of "this", yet.
> 
> Stefan
> 

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.


Mark




More information about the lambda-dev mailing list