Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
据此, 似乎具有相同的含义this。owner进一步阅读我发现owner可以参考封闭类或闭包。这是唯一的区别吗?如果是这样,为什么要为此保留整个单词?
this
owner
this指的是封闭类实例。owner指直接封闭的对象,它可能是也可能不是封闭的类实例。例如:
def x = { def y = { println this; println owner }; y() } x()
这里this指的是脚本类的实例,owner指的是x.
x