Skip to content

Support es7 exponation operator #2102

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

Closed
fdecampredon opened this issue Feb 21, 2015 · 9 comments
Closed

Support es7 exponation operator #2102

fdecampredon opened this issue Feb 21, 2015 · 9 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision ES7 Relates to the ES7 Spec Suggestion An idea for TypeScript

Comments

@fdecampredon
Copy link

https://github.com/rwaldron/exponentiation-operator I don't think it needs proposal.
Few emitting examples :

x**y 
Math.pow(x,y)

x **= y 
x = Math.pow(x, y);
@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript In Discussion Not yet reached consensus ES7 Relates to the ES7 Spec labels Feb 23, 2015
@RyanCavanaugh
Copy link
Member

Creating an ES7 label 😄

What happens if Math is shadowed in the current scope? Error?

@fdecampredon
Copy link
Author

What happens if Math is shadowed in the current scope? Error?

I guess, a more sophisticated solution could be to capture pow in some way before Math gets shadowed but it's not really necessary in my opinion. Shadowing Math is not so common....

@basarat
Copy link
Contributor

basarat commented Feb 23, 2015

What happens if Math is shadowed in the current scope

error 👍

@DanielRosenwasser
Copy link
Member

I'm sure we could just perform some appropriate tests to see if Math.pow is working correctly. (Note: this is a joke)

error 👍

That's a rather untraditional direction to take. We don't currently take that approach with String in certain places where it might be more convenient or efficient to do so. On the other hand, I think the alternative would be __exponentiate, __exp, or __pow.

@fdecampredon
Copy link
Author

@DanielRosenwasser you want to check if Math.pow return a fine result if Math has been shadowed ?

@DanielRosenwasser
Copy link
Member

Sorry, you'll have to forgive me, that was a joke. I've amended my comment to clarify it.

@fdecampredon
Copy link
Author

No that's me sorry, since my english is far from being perfect I often fail to understand what is a joke in some context ^^.

@danquirk
Copy link
Member

We obviously want/will support this when the time comes but given how early it is in ES7's development process we'd rather close this and wait on locking down exactly what ES7 is doing. As we've always said, ending up misaligned with a future ES version is our worst case scenario. Although it may be quite likely this ends up in ES7 as currently spec'd the risk of that not being the case isn't enough to add this to TypeScript today given the relatively low value of this operator.

@danquirk danquirk added Declined The issue was declined as something which matches the TypeScript vision and removed In Discussion Not yet reached consensus labels Apr 21, 2015
@RyanCavanaugh
Copy link
Member

Once ES7 decides the exact syntax here (I could see ^^ or ** happening) and whether or not it's exactly equivalent to Math.pow, we can revisit this to see about downlevel emit.

@microsoft microsoft locked and limited conversation to collaborators Jun 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Declined The issue was declined as something which matches the TypeScript vision ES7 Relates to the ES7 Spec Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants