还要设置变量作用域,以限制变量只在某个“会话”中活动。
Set the variable scope to limit variables to live only within a "session".
在清单10中可以看出,所有变量作用域是由Seam处理的。
As you can see in Listing 10, all of the variable scoping is handled by Seam.
例如,在第6章中对栈和寄存器结构的解释要联系到第4章中对变量作用域的解释。
For example, the explanation of stacks and register frames in Chapter 6 connected with Chapter 4's explanation of variable scope.
这就意味着在执行with的过程中,实际上的局部变量都被移到作用域链上的第二个位置,这会带来性能上的损失。
This means that local variables actually move to an identifier depth of two during execution of the with, imposing a performance penalty.
值得注意的是,这里有一些例外情况,GoogleChrome和最新的WebKit午夜版在访问变量的时间保持得很稳定,不会随着作用域深度的递增而增长。
The notable exceptions in this case are Google Chrome and the latest nightly WebKit as their variable access times remain roughly constant even as identifier depth increases.
编程基础(变量,数据类型,引用,指针,作用域,错误处理,迭代,核心算法-搜索,排序等)
The basics of Programming (variables, data types, references, pointers, scope, error handling, iteration, core algorithms - searching, sorting, etc.)
一个闭包封闭了这些引用,所以函数调用可以安全的引用这些变量,即使它们已经超出了函数的作用域。
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!
所有这四个变量都是在循环外声明的,尽管它们仅在循环内部使用,但作用域不止于此。
All four variables are declared outside the loop and therefore have excessive scope even though they're only used inside the loop.
为了回答这个问题,我模拟了一系列的测试,来测试不同作用域深度中变量的性能。
In order to answer this question, I set up a series of tests using variables of different scope-depth.
如果产生了异常,那么就会对那个限定了作用域的变量进行赋值:如清单18中的EL表达式所显示的那样,该变量的值将不会为空。
If an exception was raised, then assignment to the scoped variable will occur: as the EL expression in Listing 18 suggests, its value will not be empty.
仔细检查函数中所有使用的变量,如果有一个变量不是当前作用域定义的,而且使用了不止一次,那么我们就应该把这个变量保存在局部变量中,而使用这个局部变量来进行读写操作。
Watch the variables being used in a function. If you notice a function using an out-of-scope variable more than once, store it in a local variable and use that instead.
管理变量和成员作用域。
内部类以及lambda表达式一个局限性是——它们只引用来自它们的词法作用域的最终(final)局部变量。
One limitation of inner classes - and lambda expressions too - is that they can only refer to final local variables from their lexical scope.
$onlyOne变量是一个类属性,因为其作用域是这个类。
The $onlyOne variable is said to be a class attribute, as it is scoped to the class.
var属性会导致从指定URL获取的内容(作为String值)被存储在一个限定了作用域的变量中,而不是包含在当前 JSP页面中。
The var attribute causes the content fetched from the specified URL to be stored (as a String value) in a scoped variable, rather than included in the current JSP page.
这容易导致 bug,变量可能会在其目标作用域之外被重用。
This is bug-prone because variables can get reused outside of the scope in which they were intended to be used.
Firefox 3.1Beta2的表现有点出人意料,对于局部变量执行的效率非常高,但随着作用域层数的增加,效率便大打折扣。
Firefox 3.1 Beta 2 was somewhat surprising as local variable writes were very fast but performance degraded significantly once the variable was out of the local scope.
my变量有时也叫做词法变量,因为它们的作用域仅仅依赖于程序文本自身,不依赖于执行细节,例如以什么顺序来执行什么。
These 'my variables' are sometimes called' lexical 'because their scope depends only on the program text itself, and not on details of execution, such as what gets executed in what order.
通常,可选的scope属性用来指定由var属性指定的变量的作用域。
As usual, the optional scope attribute is used to specify the scope for the variable named by the var attribute.
类成员和变量被默认为是公有的(在Dart中没有“public”这个关键字),尽管对于Dart来说“public”仅仅是脚本,而并非一个涵盖整个页面的作用域。
Class members and variables are considered public by default (there's no "public" keyword in Dart), although "public" for Dart is not a scope that encompasses the entire page - just the script.
如果指定了var属性,那么将会创建一个带有指定名称的并限定了作用域的变量,并将每次迭代的当前索引值赋给该变量。
If the var attribute is specified, then a scoped variable with the indicated name will be created and assigned the current value of the index for each pass through the iteration.
SetValueBindingHandler 只定义了一个变量并把变量放置在Facelets 作用域内,这样您的逻辑标记就可以重用该变量。
The SetValueBindingHandler just defines a variable and puts the variable in the Facelets scope so your logic tags can reuse the variable.
scope属性控制该变量的作用域,缺省情况下是页面作用域。
The scope attribute controls the scoping of this variable, and defaults to page scope.
根据声明这些变量的方式及位置,这三类变量有以下五种作用域。
There are five types of scope that these three types of variables can have, depending on how and where they are declared.
它是通过为varstatus属性指定一个值,然后访问所生成的限定了作用域的变量的count特性来实现这一点的。
This is done by specifying a value for the varStatus attribute and then accessing the count property of the resulting scoped variable.
servlet上下文属性与保存在application 作用域内的JSP/JSF变量类似。
The servlet context's attributes are the same thing as the JSP/JSF variables kept in the application scope.
servlet上下文属性与保存在application 作用域内的JSP/JSF变量类似。
The servlet context's attributes are the same thing as the JSP/JSF variables kept in the application scope.
应用推荐