Skip to content

Conversation

@SanderSpies
Copy link
Contributor

@SanderSpies SanderSpies commented Feb 27, 2023

Make &, &&, |, ||, ++, and :: operators left associative.

The tradeoff here is between JS and OCaml.

Here’s the precedence list of JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Operator_Precedence#table

and here of OCaml:
https://v2.ocaml.org/api/Ocaml_operators.html

The important difference here is:

&, &&, |, ||, ^, :: right associative in OCaml (and current ReasonML default)
&, &&, |, ||, + left associative in JS. :: is obviously not present in JS and I decided to make that left associative as well as it “feels” more correct here.

See also: #2672

@SanderSpies SanderSpies changed the title wip: Change operator precedence to be left biased. Change operator precedence to be left biased. Mar 6, 2023
@SanderSpies SanderSpies force-pushed the sanderspies/precedence branch from 336a70b to 559681e Compare March 6, 2023 08:40
@SanderSpies SanderSpies marked this pull request as ready for review March 6, 2023 08:41
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.

1 participant