-
Notifications
You must be signed in to change notification settings - Fork 1.5k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
arithmetic exponentiation operator proposal #1818
Comments
Be careful, though, that Related: the |
Indeed. With this concern, the operator could be potentially modified to |
|
Does this really need to be an operator, rather than, say, a standard library function? Is this operation common enough to warrant a dedicated syntax (and requiring everyone to learn that syntax)? |
This is a fair question. But personally, I would much rather have an operator than a function call, mainly to not have to append |
FYI, moving from an issue to a discussion. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I propose that syntax and functionality for exponentiation is implemented. Currently, if you want to raise some number
x
to a power of 2, you must dox * x
. This is fine if you only want to raisex
to itself once. But, if there is ever a case where you want to raisex
to a power greater than 2, it could get ugly quickly. The operator would be like Python's exponentiation operator, which is**
. Operator overloading for this could be implemented usingRaise
andRaiseWith(U)
orExponent
andExponentWith(U)
interfaces.With this operator, raising
x
to a power of 3 could look likex ** 3
instead ofx * x * x
.The text was updated successfully, but these errors were encountered: