archives

« Bugzilla Issues Index

#2402 — Function.prototype.bind/call/apply: optional thisArg


Current ES6 draft:

19.2.3.2 Function.prototype.bind (thisArg [, arg1 [, arg2, …]]),

"The bind method takes one or more arguments, thisArg and (optionally) arg1, arg2, ..."

19.2.3.3 Function.prototype.call (thisArg [ , arg1 [ , arg2, … ] ] )

"When the call method is called on an object func with argument thisArg and optional arguments arg1, arg2..."

Both sentences and function signatures define thisArg as "required", however technically (to support `undefined` this value), thisArg is optional too, and it's possible to do: (function() {}).bind().

Probably instead of "takes" should be written "expects". And the signature can be edited to: Function.prototype.bind ([thisArg [, arg1 [, arg2, …]]])

P.S.:

In addition, this probably relates to 19.2.3.1 Function.prototype.apply (thisArg, argArray), which signature can be described with all optional parameters.


(Changing this bug's 'Product' from 'ECMA-262' to 'Draft for 6th Edition', since the Description refers to "Current ES6 draft".)


Strictly speaking, all arguments to all functions are optional and default to undefined. This is explained in clause 17.

I did tweak the prologue language a bit for bind and call.

fixed in rev25 editor's draft


fixed in rev25