Skip to content

Consider changing associativity of ^ #172

@JoeStrout

Description

@JoeStrout

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions