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

Consider changing associativity of ^ #172

Open
JoeStrout opened this issue Jul 26, 2024 · 0 comments
Open

Consider changing associativity of ^ #172

JoeStrout opened this issue Jul 26, 2024 · 0 comments

Comments

@JoeStrout
Copy link
Owner

The ^ operator in MiniScript is left-associative. There is no universal standard for this, but right associativity for this is somewhat more common, and the current behavior has surprised at least one user.

Other languages are not very consistent about this:
https://codeplea.com/exponentiation-associativity-options

Of the languages surveyed here, 11 are right-associative, and 6 are left-associative. Even handheld calculators don't all agree on this.

https://en.wikipedia.org/wiki/Exponentiation#In_programming_languages says that "most" languages make it right-associative, but notable exceptions are Algol, MATLAB, and Excel, which could all be considered "math-oriented" languages.

So, hmm.

Given all this, I'm inclined to say that it would be better if it were right-associative. The question is, should we risk breaking code by changing the design at this point? I'm not sure.

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

No branches or pull requests

1 participant