ECMAScript(ECMA-262 5.1)中`reference`的“基本值”是什么? [英] What is `base value` of `reference` in ECMAScript(ECMA-262 5.1)?

查看:100
本文介绍了ECMAScript(ECMA-262 5.1)中`reference`的“基本值”是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力理解如何在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 flagto 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:

  • 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆