现在您已经洞悉了闭包这个术语。
现在您已经洞悉了闭包这个术语。
这些闭包名称反映了它们的含义。
用闭包进行定制会有一些惊人之处。
Customization with closures can take you in some surprising places.
可以使用匿名的内部类来实现闭包。
Primarily, you can use anonymous inner classes to implement closures.
您已经知道如何使用现成的闭包。
这种闭包也可以包含间接关联路径。
闭包是函数语言的共有特征之一。
Closures are one of the common features of functional languages.
括号中的代码叫做闭包或代码块。
The code between brackets is called a closure, or code block.
第二个参数是一个函数闭包。
要了解闭包,首先需要了解匿名函数。
To understand closures, one first has to understand anonymous functions.
有了闭包,您也可以从外到里进行重构。
方法或函数可通过传入参数与闭包通信。
A method or function can communicate with a closure by passing in arguments.
应当能够访问所有的闭包。
它执行三次闭包中的代码。
注意,稍后您也可以使用闭包和引用变量。
Note that you can use closures and reference variables later too.
清单4中的闭包类似于您当时创建的闭包。
The closure in Listing 4 is similar to the one that you created back then.
它们还可以像普通函数一样内省到闭包中。
They can also introspect into a closure just like a normal function can.
闭包有什么特别之处?
闭包是具有闭合作用域的匿名函数。
您可以根据需要通过闭包构建自己的抽象概念。
You can build in your own abstractions as needed, with closures.
如果没有指定,函数将在定义它的闭包中运行。
A function will run in the closure that defines it unless otherwise specified.
让我们在此基础上了解如何在php中使用闭包。
我们可以通过将闭包定义为静态闭包禁用此行为。
We can disable this behavior by defining the closure to be static.
您说的是闭包吗?
闭包还有一项重大的优势:让实施策略变得容易。
Closures have another huge advantage: they make it easy to enforce policy.
定义这个闭包之后,在frame闭包中调用它。
Once the closure is defined, I call it inside of the frame closure.
但是,这些现有的闭包返回的值是html格式的。
这个示例中所使用的生成递归闭包的方法有些冗长。
The way of making recursive closures used in this example is a bit tedious.
对于这个函数,我们再次使用了一个简短的闭包注释。
For the function, we are once again using the shorthand closure notation.
应用推荐