Skip to content
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

Implement exponential operator (**) to GDScript/Expressions #58873

Merged
merged 1 commit into from
May 11, 2022

Conversation

Chaosus
Copy link
Member

@Chaosus Chaosus commented Mar 7, 2022

Added a support for pow operator to GDScript and Expressions:

pow_expression

Closes godotengine/godot-proposals#1045
Closes godotengine/godot-proposals#1580

@Mickeon
Copy link
Contributor

Mickeon commented Mar 7, 2022

Aah, I wish ^ wasn't reserved for the Bitwise XOR in GDScript, too. It would've been a nice opportunity to make it closer to the mathematical symbol, but I do digress.

Because of Python's influence, would it mean that, should this PR get merged, the Floor Division operator would be added, as well?

@Chaosus Chaosus requested a review from a team as a code owner March 7, 2022 18:21
@Chaosus
Copy link
Member Author

Chaosus commented Mar 7, 2022

Because of Python's influence, would it mean that, should this PR get merged, the Floor Division operator would be added, as well?

Well, if the community have an interest in it - then why not? But as a proposal its better to be shown on the godotengine/godot-proposals first.

@Chaosus Chaosus requested a review from vnen March 7, 2022 18:46
@Chaosus Chaosus force-pushed the power_op branch 2 times, most recently from 2ad79ee to e0e99bd Compare March 7, 2022 18:59
@Chaosus Chaosus changed the title Implement exponential operator (**) to GDScript Implement exponential operator (**) to GDScript/VScript/Expressions Mar 7, 2022
@Mickeon
Copy link
Contributor

Mickeon commented Mar 7, 2022

Never mind about the Floor Division proposal. As a point of reference, it didn't go so well last time.

@Chaosus
Copy link
Member Author

Chaosus commented Mar 7, 2022

Never mind about the Floor Division proposal. As a point of reference, godotengine/godot-proposals#1866.

Ah, I see. Than maybe it may be a source of confusion and not so needed for games as for the python developers.

@Chaosus Chaosus force-pushed the power_op branch 2 times, most recently from 2241159 to 6f7bb4b Compare March 8, 2022 06:39
@reduz
Copy link
Member

reduz commented Mar 8, 2022

Variant already provides the pow() function as builtin method. I would not add this to Variant as its more bloat. It can be simply syntax sugar in Expression and GDScript that ends up calling pow() internally.

@Chaosus Chaosus marked this pull request as draft March 8, 2022 14:52
@Chaosus Chaosus force-pushed the power_op branch 2 times, most recently from eed3698 to 9110ad3 Compare March 9, 2022 10:49
@Chaosus
Copy link
Member Author

Chaosus commented Mar 9, 2022

@reduz To be honest without adding it to Variant is much more "bloating" to do rather than otherwise.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with reduz that this addition duplicates the pow function and adds confusion.

@Chaosus Chaosus force-pushed the power_op branch 2 times, most recently from 123327c to 4821831 Compare April 24, 2022 06:18
@Chaosus Chaosus changed the title Implement exponential operator (**) to GDScript/VScript/Expressions Implement exponential operator (**) to Expressions Apr 24, 2022
@Chaosus Chaosus marked this pull request as ready for review April 24, 2022 06:18
@Chaosus Chaosus changed the title Implement exponential operator (**) to Expressions Implement exponential operator (**) to GDScript Apr 26, 2022
@Chaosus Chaosus changed the title Implement exponential operator (**) to GDScript Implement exponential operator (**) to GDScript/Expressions Apr 26, 2022
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, there's just a stray modules/gdnative that got re-added and should be removed.

@Chaosus
Copy link
Member Author

Chaosus commented May 11, 2022

@akien-mga Done, I've removed it!

@akien-mga akien-mga merged commit d68c355 into godotengine:master May 11, 2022
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Add exponentiation operator (**) to the Expression parser Add exponentiation operator (**) to GDScript
7 participants