-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Normative: Add Exponentiation Operator #318
Conversation
ca11baa
to
e99b6fc
Compare
@@ -10350,7 +10350,7 @@ | |||
<emu-note> | |||
<p>The following are the only restricted productions in the grammar:</p> | |||
<emu-grammar> | |||
PostfixExpression[Yield] : | |||
IncrementExpression[Yield] : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know I'm bikeshedding here, but calling this production IncrementExpression
really bothers me when two of the four possibilities is a decrement. The SpiderMonkey AST called this an UpdateExpression
. Could we go with that instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I like that better. Update to follow
0732ab1
to
042fdf8
Compare
I still think we should use the default operator evaluation order for the exponentiation operator (tc39/proposal-exponentiation-operator#10). The current implementations in Edge and SpiderMonkey also use the default evaluation order. var leftValue = {valueOf(){ print("left-value"); return 3; }};
var rightValue = {valueOf(){ print("right-value"); return 2; }};
// Output with current proposal: "left", "leftValue", "right", "rightValue"
// Default operator evaluation order: "left", "right", "leftValue", "rightValue"
print((print("left"), leftValue )**(print("right"), rightValue)); |
I can't really follow those notes in that issue because I don't think they're aligned with the latest version of the feature spec—I tried to matching things up, but I'm exhausted at the moment and that was a bad idea. |
I see the order of ops now, that may have been me being overzealous in my "clean ups" and just overlooking the change in semantics. Thanks @anba |
042fdf8
to
57b25f0
Compare
1. Let _rightValue_ be ? GetValue(_right_). | ||
1. Let _base_ be ? ToNumber(_leftValue_). | ||
1. Let _exponent_ be ? ToNumber(_rightValue_). | ||
1. Return the result of <emu-xref href="#sec-applying-the-exp-operator" title>Applying the ** operator</emu-xref> with _base_ and _exponent_ as specified in <emu-xref href="#sec-applying-the-exp-operator"></emu-xref>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yessir, looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@anba thanks again for taking a look at this, your attention is always greatly appreciated :)
57b25f0
to
9da6773
Compare
Rebased on dfeaa39 |
🎆 |
🎆 ** 🎆 |
Thanks everyone!
|
No description provided.