ECMAScript(ECMA-262 5.1)中`reference`的“基本值”是什么? [英] What is `base value` of `reference` in ECMAScript(ECMA-262 5.1)?
问题描述
我一直在努力理解如何在javascript中设置这个
值,并发现ECMAScript语言规范非常有帮助。我正在阅读第8.7节 参考规范类型
,发现ECMAScript中的引用由3个组件构成,基值
,引用名称
,严格参考标志
了解第11.2.3节。
I've been trying to understand how this
value is set in javascript, and found ECMAScript Language Specification pretty much helpful. I was reading section 8.7 reference specification type
and found that reference in ECMAScript is made of 3 component, base value
, referenced name
, strict reference flag
to understand section 11.2.3.
我可以假设什么是引用名称
和严格引用标志
从他们的名字,但我不明白什么是基值
。该文件说基值
是未定义
,字符串
,布尔
,数字
和对象
,但它没有说它是如何设置的以及它是什么。我猜这是类似于上下文对象的东西。有人可以解释一下吗?
I can assume what are referenced name
and strict reference flag
from their name, but i don't understand what is the base value
. The document says that base value
is either undefined
, String
, Boolean
, Number
and Object
, but it does not say how it is set and what it is. I am guessing it is something similar to context object. Could anyone explain?
推荐答案
是的,基础值是引用名称所在的上下文。
Yes, the base value is the context in which the referenced name lives.
对于对象属性,这将是对象(参见§8.12用于setter / getter操作的对象内部方法。对于变量,这将是变量环境(§10.2.1环境记录)。对于无法解析的引用(抛出引用错误的内容除非提供给 typeof
),这将是 undefined
。
For an object property, this would be the object (see §8.12 Object internal methods for setter/getter operations). For a variable, this would be the variable environment (§10.2.1 Environment records). For an unresolvable reference (the things that throw reference errors except when supplied to typeof
), this would be undefined
.
它没有说明如何设置
it does not say how it is set
参考
值仅由极少数操作构成:
Reference
values are only constructed by very few operations:
- 标识符参考表达式,解析: @es $.g $> =http://es5.github.io/#x11.2.1\"rel =nofollow noreferrer>属性访问者表达式,即
- 允许对主机功能的函数调用返回他们,但不存在。
....
和 [...]
运营商 - identifier reference expressions, that resolve the identifier in the current lexical environment (or one of its parents)
- property accessor expressions, i.e. the
.…
and[…]
operators - function calls to host functions are permitted to return them, but such don't exist.
这篇关于ECMAScript(ECMA-262 5.1)中`reference`的“基本值”是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!