New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing description of [[thisMode]] internal slot of Function Object. #1305

Open
ENvironmentSet opened this Issue Sep 12, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@ENvironmentSet

ENvironmentSet commented Sep 12, 2018

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.

@ljharb

This comment has been minimized.

Show comment
Hide comment
@ljharb

ljharb Sep 12, 2018

Member

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".

Member

ljharb commented Sep 12, 2018

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".

@ENvironmentSet

This comment has been minimized.

Show comment
Hide comment
@ENvironmentSet

ENvironmentSet Sep 15, 2018

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.

ENvironmentSet commented Sep 15, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment