Repeat:
Each call to an object’s internal method has a “target”, the object to which the call is made.
"Receiver" is a parameter of 2 nd of the [[Get]] method and 3 rd of the [[Set]] method.
Other internal object methods do not have this additional parameter.
Then why do [[Get]] and [[Set]] have a receiver? Because it is not a goal.
The receiver is used to call getter and setter in the [[Get]] / [[Set]] area.
ES6 9.1.8 :
- You call
A.Get( 'property', A ) - If A does not have a property,
A.prototype.Get( 'property', A ) called.- The target is now "A.prototype". But the receiver remains "A".
- If A.prototype has a getter function for the property, it will be called with receiver A instead of the target A.prototype.
Note that ES5 [[Get]] (8.12.3) does the same thing differently and without a receiver, in part because the ascent prototype takes place in another part (8.12.2).
The receiver exists only in the context of [[Get]] and [[Set]] and serves a different purpose than the target.
When [[Get]] is necessary to indicate your goal, use O.
O differs for each recursive call [[Get]] when it goes up the prototype chain.
The receiver remains the same as [[Get]] goes up the prototype chain. Its value is passed to getter as a parameter, and the following does not occur in the same area as the receiver.
O and Receiver can refer to the same object, but this does not matter in the context of [[Get]] or [[Set]]. In fact, Reflect.get allows the caller to set a different target and receiver and to distinguish them from the transition.
For other methods of internal objects, most of them do not go up the prototype chain at all. The two that do ( [[HasProperty]] and [[Enumerate]] ) do not need to keep the original target (so to speak).
With that in mind, you then ask if the Recipient specification gives a value that will be used in a general discussion of JavaScript, for example, how it defines a “target” in 6.1.7.2. This answer is no.
"Receiver" has a very narrow scope, which is used only as a parameter name, but "target" is used there in a general, less formal way.
"target" is a term borrowed from general discussion - ES5 does not define the concept of a call target. ES5 "target" may be a parameter, variable, expression, expression, or function called. But not an implied replacement for this .
The spectrum is written to convey "JavaScript behavior" in very, very precise terms, which makes it very technical, including the use of a parameter. It just serves for different communication than general discussions in programming.
3.a. Many JS developers do not read the spec at all. This is not necessary for everyday encoding.
3.b. We are talking about “closing”, “chaining areas”, “event queue” and “bold arrow” or “lambda”, right? The specification did not define any of these conditions.
3.c. A specification may call things differently, for example, in the context of execution or in a job queue.
It may just not name things. Closing is a new behavior.
And when he calls the name, he does not create a pseudonym. The arrow function is never called a lambda.
The spectrum does not govern general discussions.
Use common sense for general discussions.
source share