Avoid multiple nested function calls. Use composition instead.
请避免使用多层嵌套函数调用,使用组合函数去替代。
What if we need to use a variable that is defined outside a nested function.
那如果我们需要使用定义在嵌套函数外面的变量呢?
When a nested function is used in this way, it is often explicitly called a closure.
当某个内嵌函数被这样使用时,它通常就被称作闭包。
Consider the following code, which includes a function that returns a nested function.
思考一下下面的代码,它包括一个能够返回内嵌函数的函数。
Things are different if you save a reference to the nested function in the global scope.
但如果你在全局作用域上保存了对内嵌函数的引用,事情就不一样了。
Here is an alternate way to accomplish the same, if you feel unfamiliar with nested function calls.
好吧,如果你不太熟悉嵌套的函数调用,这是另一种写法。
What if we need to use a variable that is defined outside a nested function. Consider this contrived example.
那如果我们需要使用定义在嵌套函数外面的变量呢?考虑下面的例子。
If the nested function is used only within the outer function, however, the only reference to the nested function is in the call object.
如果内嵌函数只是在外部函数中使用到,那么对内嵌函数的唯一引用就是调用对象自己。
These closures are only interesting, however, in the case discussed above: when a nested function is exported outside the scope in which it is defined.
然后这些闭包只在上面讨论的这些情形下才显得有趣:当某个内嵌函数被暴露在它所被定义的作用域外时。
In this case, there is an external reference to the nested function, and the nested function retains its reference to the call object of the outer function.
如果内嵌函数只是在外部函数中使用到,那么对内嵌函数的唯一引用就是调用对象自己。
The reason C and C++ never adopted nested functions is because in order to make capture work, you need additional information, with the result that a pointer to function becomes more complex.
C和c++的原因从未采用嵌套函数是因为为了使捕获的工作,你需要额外的信息,其结果是一个指针函数变得更加复杂。
When generating SQL expressions for measures that reference other measures, the aggregation function might not be used to form the SQL expression for the nested measures.
如果一个度量引用其他度量,那么在为它产生SQL表达式时,不能使用聚合函数来为嵌套的度量产生SQL表达式。
A nested, or inner, function can inherit the arguments and variables of its outer function, and is private to that function.
一个嵌套的内部函数可以继承外部函数的参数和变量,并由该外部函数私有。
If that's not what you want (and it's almost always not what you want), then you can use the built-in deepcopy function instead, which duplicates any nested data structure "all the way down".
如果这不是您想要的(通常发生这种情况),您可以使用内置的deepcopy函数,它会一直复制任何嵌套的数据结构。
The XQuery where clause can consist of nested expressions of arbitrary complexity that can even include function calls.
XQuerywhere子句可以包含任意复杂的嵌套表达式,甚至可以包含函数调用。
Note that the inv function USES SPL nested lists to represent matrices, as there is no matrix type in SPL.
请注意,inv函数使用SPL嵌套列表来表示矩阵,因为SPL中没有矩阵类型。
The inputTag function has a slightly different layout in that it has a nested XHTML label tag, as shown in Listing 11.
inputtag函数的布局稍有不同,因为它有一个嵌套的XHTML标签标记,如清单11所示。
Notice the nested doClose function.
注意嵌套的 doClose函数。
Term used to describe function scope and the scopes nested inside a function.
用于描述函数作用域和函数内嵌套的作用域的术语。
Figure 23 shows the output rules for the functional map named Func_Line1. This map USES nested instances of the WORD function to extract the Tag and value for each XML element.
图23显示功能性映射Func_Line1的输出规则。
Then use the repeater function, so that the nested AC repeats over the stack.
然后用这个复制功能,让导入的AC在堆栈上重复运行。
Then use the repeater function, so that the nested AC repeats over the stack.
然后用这个复制功能,让导入的AC在堆栈上重复运行。
应用推荐