The second parameter is a function closure.
第二个参数是一个函数闭包。
In this case, you used an anonymous inline function, also known as a closure.
在这个案例中您使用一个匿名内联函数,也称为一个闭包。
For the function, we are once again using the shorthand closure notation.
对于这个函数,我们再次使用了一个简短的闭包注释。
By default, they are passed by value, meaning that if we would update the value passed within the closure function definition, it would not update the outside value.
默认情况下,它们是由值传递的,意味着如果要更新传递到闭包函数定义内的值,则不更新外部值。
This closed scope is the communication that ties the closure to the calling function and the code that defines it.
这个闭合的作用域是将闭包同调用函数和定义它的代码联系起来的纽带。
In this case the returned function object is a closure which encapsulates some logging code and the data needed to call the original function.
这种情况下返回的函数对象就是一个闭包,其中封装了一些日志代码和最初的函数调用所需要的数据。
A function will run in the closure that defines it unless otherwise specified.
如果没有指定,函数将在定义它的闭包中运行。
Curious readers will be wondering what makes a functor different from an anonymous function or closure.
好奇的读者会想是什么使仿函数不同于匿名函数或闭包呢?
When an inner function gains and USES access to its outer function's variables it is known as a closure.
当内部函数获得和使用其外部函数的变量时,就称其为一个闭包。
It ACTS like a macro in this context, where calling the method of function via the closure makes the function call in the context of where it's defined.
它在此上下文中用作宏,通过闭包调用函数方法将在定义它的上下文中执行函数调用。
A Groovy Closure is an anonymous function that can access its enclosing scope, can be called repeatedly at will, and be passed around as it were data.
一个Groovy闭包是一个匿名函数,它可访问包含它的范围,可随意被重复调用,并可将其当作数据到处传递。
Function literals and the related concept of a closure are discussed in the section called "Function literals and Closures" in Chapter 8, Functional Programming in Scala.
字面函数和闭包相关的概念会在《第8章-scala函数式编程》的“字面函数和闭包”章节中被讨论。
However, we can set up a closure at the beginning of the function to keep the string from having to be passed on each call.
不过,我们可以在函数的起始处设置一个闭包(closure),以使得不再必须为每一个调用都传递那个字符串。
Variables to be imported from the outside environment are specified in the use clause of the closure function definition.
从外部环境中导入的变量是在闭包函数定义的use子句中指定的。
To build a function that USES a closure, you simply use the yield keyword to invoke the closure.
要构建一个使用闭包的函数,只需要使用yield关键字来调用该闭包。
The closure of a peer socket can also be detected with the write API function.
同样,可以用writeapi函数来探测对等套接字的闭包。
For the error callback function, you pass a simple closure that simply displays the error information.
如果callback函数失败,就传递一个显示失败信息的终止参数。
The closure captures the information about the actual Web service method stub to be invoked (the function object called obj) as well as the stream for the log output.
闭包捕获真正被调用的Web服务方法存根(称为obj的函数对象)以及流作为日志输出。
Notice that once again, we used a shorthand closure for the predicate function passed to the filter function.
请再次注意,我们为传递给filter函数的断言函数使用了一个简短的闭包。
The only other important thing to note is the callback function, or, the closure created for the request's onreadystatechange function.
除此之外,惟一需要注意的是回调函数,或者为请求的onreadystatechange函数创建的闭包。
Though you can pass another closure to it, instead pass it a reference to another function called addEmployee.
尽管您可以传递另一个闭包给它,而不是将其作为一个引用传递给另一个名为addemployee的函数。
Here's another way to look at it: If an object is data with methods that operate on that data, then a closure is a function with data bound to that function.
从另一个角度来看:如果object是带有在其上运行的方法的数据,那么closure是绑定了数据的函数。
You then pass in an anonymous function (closure) to the onEvent property.
然后将一个匿名函数(closure)传入到onevent属性。
As the above example illustrates, a closure is a function that is "closed over" specified variables.
正如上面例子说明的,closure是“closedover”特定变量的函数。
A closure "closes around" these references, so the function invocation can safely refer to the variables even when the variables have gone out of scope!
一个闭包封闭了这些引用,所以函数调用可以安全的引用这些变量,即使它们已经超出了函数的作用域。
A closure is a function that carries an implicit binding to all the variables referenced within it.
闭包是一个会对它内部引用的所有变量进行隐式绑定的函数。
They can also introspect into a closure just like a normal function can.
它们还可以像普通函数一样内省到闭包中。
A method or function can communicate with a closure by passing in arguments.
方法或函数可通过传入参数与闭包通信。
A closure is a function that is evaluated in its own environment, which has one or more bound variables that can be accessed when the function is called.
闭包是在它自己的环境中执行计算的函数,它有一个或多个绑定变量可以在调用函数时访问。
How can I rewrite this so that Closure Compile renames my function?
我如何重写这个这样关闭编译重命名我的函数吗?
应用推荐