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

Change associativity of exponentiation to 'right' #557

Merged
merged 2 commits into from Jun 13, 2019

Conversation

taboege
Copy link
Member

@taboege taboege commented Jun 13, 2019

Just stumbled on this:

https://github.com/perl6/nqp/blob/7cccdb13e28b2aea7321bdef02408f842183d477/src/NQP/Grammar.nqp#L747

Exponentiation should be right-associative (like it is in Perl 6), no? The test suite passed before and passes after this PR, so I am not sure if this will have fall-out downstream. The second commit adds tests for the ** operator which hasn't been exercised at all.

Maybe this is an instance of "if it's not (too) broken, don't fix it"?

The associativity of the %exponentiation infix spec in NQP::Grammar
was 'left' which does not match usual convention in mathematics and
the associativity of ** in Perl 6. This commit changes it to 'right'.
The exponentiation operator was not exercised before.
@tbrowder
Copy link
Member

That looks good to me--good catch! You should be able to merge it yourself.

Thanks!

@taboege
Copy link
Member Author

taboege commented Jun 13, 2019

Ok, just to be extra, extra sure I built rakudo and ran its test suite and the spectest with these patches applied to the backing nqp. Really doesn't seem to break anything.

@taboege
Copy link
Member Author

taboege commented Jun 13, 2019

@tbrowder : No, apparently I have no write permissions to nqp, so I can't merge it myself.

@b2gills
Copy link

b2gills commented Jun 13, 2019

I'm sure that no one has ever tried using two or more exponentiation operators in NQP.

@taboege
Copy link
Member Author

taboege commented Jun 13, 2019

And finally we know why :-)

@tbrowder tbrowder merged commit 85775f0 into Raku:master Jun 13, 2019
@tbrowder
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

None yet

3 participants