Ecma262: Fixing description of [[thisMode]] internal slot of Function Object.

Created on 12 Sep 2018  路  5Comments  路  Source: tc39/ecma262

in current, specification explain [[thisMode]] of Function Object as blow.

Defines how this references are interpreted within the formal parameters
and code body of the function. lexical means that this refers to the this
value of a lexically enclosing function. strict means that the this value is used
exactly as provided by an invocation of the function. global means that a this
value of undefined is interpreted as a reference to the global object.

and I think, this line missed some action about how global this mode works.

global means that a this
value of undefined is interpreted as a reference to the global object.

because, In OrdinaryCallBindThis abstract operation that used to bind this value into function environment record. It interpret null as reference to global object like undefined.

So, In my opinion, changing that line to blow will make more clear specification.

global means that a this
value of undefined or null is interpreted as a reference to the global object.

editorial change good first patch spec bug

Most helpful comment

and, another one about this.

in step 6.b.i of OrdinaryCallBindThis it convert primitive value to Object. we may add information about this too.

All 5 comments

Indeed, in step 6.a of https://tc39.github.io/ecma262/#sec-ordinarycallbindthis it checks undefined or null; which suggests that the text in https://tc39.github.io/ecma262/#table-27 should be changed from "undefined" to "undefined or null".

and, another one about this.

in step 6.b.i of OrdinaryCallBindThis it convert primitive value to Object. we may add information about this too.

Indeed, in step 6.a of https://tc39.github.io/ecma262/#sec-ordinarycallbindthis it checks undefined or null; which suggests that the text in https://tc39.github.io/ecma262/#table-27 should be changed from "undefined" to "undefined or null".

I'd like to take that on if nobody minds 馃檪

and, another one about this.

in step 6.b.i of OrdinaryCallBindThis it convert primitive value to Object. we may add information about this too.

Can add that too, would love any suggestions on how to go about this. Thanks!

@viktmv what about this sentence?

global means that a this value of undefined or null is interpreted as a reference to the global object and a this value of primitive type is wrapped by it's type's wrapper object.

@ENvironmentSet makes perfect sense. Will add a commit for that. Thank you!

Was this page helpful?
0 / 5 - 0 ratings