reason
reason copied to clipboard
`++` operator is right associativity
Most languages have +
as left associativity, this applies to OCaml as well.
isn't this because OCaml ^
is right associative and that's what ++
translates to?
In my opinion this is a leaky abstraction, when I am using reason syntax why do I need remember that it maps to ^ in ocaml
Sorry, I didn't mean to question why we would change it, just why it ended up this way.
Yes, this should be changed and it's one of the things I've been planning to do in the next breaking change. It has to be in a breaking change though and those have to be batched. Thanks for reminding me.
The original reason for it being left associative is not a good reason. It was so that when converting from OCaml code, you don't end up with some really funny looking output like "((hi" ++ "bye") ++ "there")
.