Groovy -- What is the difference between this and owner -


according this this , owner seem have same meaning. reading further find owner can refer enclosing class or closure. difference? if so, why reserve entire word that?

this refers enclosing class instance. owner refers directly enclosing object, may or may not enclosing class instance. example:

def x = { def y = { println this; println owner }; y() } x() 

here this refers instance of script class, , owner refers x.


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -