在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
我想我的问题也可能是这样:闭包对行动有什么好处?