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

[es6-super-construct] Make 'super()' an early error in ordinary functions #20

Closed
dslomov opened this Issue Jan 8, 2015 · 3 comments

Comments

Projects
None yet
4 participants
@dslomov
Contributor

dslomov commented Jan 8, 2015

Per es6-super-construct proposal, 'super()' invocation in ordinary functions always throws:

  • In [[Call]] of that function 'super()' throws because 'super()' always throws on [[Call]](due to 'this' being always initialized in [[Call]])
    • In [[Construct]] of that function 'super()' throws, because ordinary functions are not "defined using a class definition that has an extends clause" so 'this' starts initialized when [[Construct]]ing.

We have a precedent already for concise methods where an occurrence of 'super()' call (DirectSuper) is an early error.
It will greatly help language usability if the same applies to ordinary functions (implementations can provide better error messages; the bugs are sure to be discovered)

@wycats

This comment has been minimized.

Show comment
Hide comment
@wycats

wycats Jan 9, 2015

Contributor

I think I remember Microsoft being worried about too many early errors because they force more aggressive evaluation of function bodies? @bterlson ?

Contributor

wycats commented Jan 9, 2015

I think I remember Microsoft being worried about too many early errors because they force more aggressive evaluation of function bodies? @bterlson ?

@allenwb

This comment has been minimized.

Show comment
Hide comment
@allenwb

allenwb Jan 9, 2015

Member

On Jan 9, 2015, at 9:42 AM, Yehuda Katz wrote:

I think I remember Microsoft being worried about too many early errors because they force more aggressive evaluation of function bodies? @bterlson ?

No, its more extensive analysis of function bodies prior to first evaluation of anything in a script because a script with early errors must not execute any code.

However, this one additional early error, given the early errors we already have seems unlike to make much difference.

Member

allenwb commented Jan 9, 2015

On Jan 9, 2015, at 9:42 AM, Yehuda Katz wrote:

I think I remember Microsoft being worried about too many early errors because they force more aggressive evaluation of function bodies? @bterlson ?

No, its more extensive analysis of function bodies prior to first evaluation of anything in a script because a script with early errors must not execute any code.

However, this one additional early error, given the early errors we already have seems unlike to make much difference.

@domenic

This comment has been minimized.

Show comment
Hide comment
@domenic

domenic Mar 25, 2015

Member

ES6 is done, doing some housecleaning!

Member

domenic commented Mar 25, 2015

ES6 is done, doing some housecleaning!

@domenic domenic closed this Mar 25, 2015

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