2.3.1 [ECMA-262/6] Section 19.2.3.2 Function.prototype.bind ( thisArg , ...args)
E0008: Function.prototype.bind() creates functions with additional caller and arguments properties
The specification states:
-
4.3.34 own property property that is directly contained by its object 8.2.2 CreateIntrinsics ( realmRec ) ... ... 9. Let funcProto be CreateBuiltinFunction(realmRec, noSteps, objProto). 10. Set intrinsics.[[%FunctionPrototype%]] to funcProto. 11. Call thrower.[[SetPrototypeOf]](funcProto). 12. Perform AddRestrictedFunctionProperties(funcProto, realmRec). 9.2.5 FunctionCreate (kind, ParameterList, Body, Scope, Strict, prototype) ... 1. If the prototype argument was not passed, then a. Let prototype be the intrinsic object %FunctionPrototype%. 9.2.7 AddRestrictedFunctionProperties ( F, realm ) ... ... 3. Let status be DefinePropertyOrThrow(F, "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: true}). 4. Assert: status is not an abrupt completion. 5. Return DefinePropertyOrThrow(F , "arguments", PropertyDescriptor {[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: true}). 9.3 Built-in Function Objects ... Unless otherwise specified every built-in function object has the %FunctionPrototype% object (19.2.3) as the initial value of its [[Prototype]] internal slot. 9.4.1.3 BoundFunctionCreate (targetFunction, boundThis, boundArgs) ... ... 2. Let proto be targetFunction.[[GetPrototypeOf]](). ... 8. Set the [[Prototype]] internal slot of obj to proto. 19.2.3.2 Function.prototype.bind ( thisArg , ...args) ... ... 4. Let F be BoundFunctionCreate(Target, thisArg, args).
All document modes (All versions)
Function.prototype.bind()
creates functions with additional caller
and arguments
properties. These properties should be
inherited from the Function prototype (%FunctionPrototype%
).
The 5.1 Edition of the ECMAScript® Language Specification of
the version of the spec said that bind
should add
caller
and Arguments
own properties to the created bound function. However, later specifications do
not.
These are the relevant lines from the 5.1 Edition:
15.3.4.5 Function.prototype.bind (thisArg [, arg1 [, arg2, …]])
...
...
20. Call the [[DefineOwnProperty]] internal method of F with arguments "caller",
PropertyDescriptor,
{[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
and false.
21. Call the [[DefineOwnProperty]] internal method of F with arguments "arguments",
PropertyDescriptor,
{[[Get]]: thrower, [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
and false.