About Reference type
Maxim Vaarwel
paloshmax at gmail.com
Sun Feb 18 02:16:01 UTC 2018
I want to ask some questions about Reference in ECMAScript.
1. What data is of type Reference in the specification?
2. The specification says that: "The base value component is either
undefined, an Object, a Boolean, a String, a Symbol, a Number, or an
Environment Record". Almost everything is listed here. What in this case
will not be the Reference type? And I would like to see examples of code
with each base value. For example:
/// Definition variable in javascript code (example of javascript code)
var a;
/// Reference structure in engine
Reference = {
Base: Environment Record, /// It's one of other cases
ReferencedName: "a",
StrictReference: false
}
/// Is there a difference between the two expressions?
"someString".toString; /// ƒ toString() { [native code] }
/// and
var storage = "otherString";
storage.toString; /// ƒ toString() { [native code] }
The question is how to calculate these expressions?
How will the Reference type fields be filled?
What how I think (maybe it's wrong, I don't know)
/// "someString".toString;Reference = { Base: "someString",
ReferencedName: "toString", StrictReference: false}
/// storage.toString;
Reference = {
Base: storage,
ReferencedName: "toString",
StrictReference: false
}
Yeah, difference in Base value. Can simple string such as "someString" be Base?
1. In the code, in the global code there is a variable bar (declared, bar -
example of variable). We can address to it as window.bar orbar ... and
here the most interesting. With window.bar what is base? And when bar?
We know that declarations in the global code are the Object Records
Environment, and if so, base will be appeal to the bar Records
Environment. But appeal to the window.bar, base will be a window -
type(Object). And here it is not clear. If this is an object environment,
then why call through dot will be a window object, but not an object
environment?
2. If inside of object we work with property object, the property of
this object will have a Declarative Records Environment or Object Records
Environment.
My question is complexity. But type Reference is too hard for understanding
without additional explanation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20180218/f2b55837/attachment.html>
More information about the es-discuss
mailing list