Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upWonky evaluation order for SuperProperty #1175
Comments
ljharb
added
normative change
question
needs data
web reality
labels
Apr 18, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
It’d be good to know what edge does here. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jridgewell
Apr 18, 2018
Member
I'll try downloading an IE VM. In the meantime, try https://output.jsbin.com/miderik/1/quiet if you already have one.
|
I'll try downloading an IE VM. In the meantime, try https://output.jsbin.com/miderik/1/quiet if you already have one. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Whoo, SauceLabs to the rescue. Edge 16 doesn't throw. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
Apr 18, 2018
Member
In that case, it's 50/50, so it could go either way for web compat.
How might this change impact future proposals, like decorators or private class methods?
|
In that case, it's 50/50, so it could go either way for web compat. How might this change impact future proposals, like decorators or private class methods? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
allenwb
Apr 18, 2018
Member
I agree, resolving this first would be more consistent with normal left-to-right evaluation order. Since this is only observable in a constructor using unlikely code pattern I don't think there will be any problem with changing it.
|
I agree, resolving |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bakkot
Apr 18, 2018
Contributor
This is kind of an interesting question. On the one hand, it's inconsistent with member access. On the other, the current behavior is strictly more useful, albeit only in extremely weird cases.
Because of those competing values I don't personally care much either way, though I'd lean towards prioritizing the first (i.e., changing the spec to throw for super[super()]).
|
This is kind of an interesting question. On the one hand, it's inconsistent with member access. On the other, the current behavior is strictly more useful, albeit only in extremely weird cases. Because of those competing values I don't personally care much either way, though I'd lean towards prioritizing the first (i.e., changing the spec to throw for |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
gsathya
May 23, 2018
Member
As others point out, it does seem very inconsistent to have this[super()] throw, but not super[super()]. +1 for changing the spec to throw.
|
As others point out, it does seem very inconsistent to have |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
+1 |
jridgewell commentedApr 18, 2018
•
edited
Per the spec:
This differs from regular
MemberExpression:The fact that we evaluate the the inner
[ Expression ]before evaluating thesuperfeels wrong. I realizesuper.propertyisn't really aMemberExpression, but it looks just like it. This is observable withsuper[super(), "prop"], allowing me to initialize the this binding (GetThisEnvironment ().BindThisValue(...)) even after I've referenced it.Can we move the
env.GetThisBinding()intoSuperProperty'sRS: Evaluation?As for real-world implementations of
super[super(), "prop"]:🤷♂️ No