【发布时间】:2012-03-01 14:09:34
【问题描述】:
在 grails 2.0 中有什么新的 http://grails.org/doc/2.0.0.RC1/guide/introduction.html#whatsNew
它说:1.1.3 Web Features
Controller Actions as Methods
It is now possible to define controller actions as methods instead of using closures as in previous versions of Grails. In fact this is now the preferred way of expressing an action.
例如:
// action as a method
def index() {
}
// action as a closure
def index = {
}
为什么这很重要?有什么区别?
更新:我发现这个讨论讨论了很多关于范围和一些非常多毛的东西。 http://grails.1312388.n4.nabble.com/Controller-actions-methods-or-closures-was-Re-grails-dev-Statically-typed-meta-programing-td3048287.html
我想我的问题也可能是这样的:闭包对操作有什么好处?
【问题讨论】: