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

++ operator is right associativity #2577

Open
bobzhang opened this issue May 16, 2020 · 5 comments
Open

++ operator is right associativity #2577

bobzhang opened this issue May 16, 2020 · 5 comments

Comments

@bobzhang
Copy link
Contributor

Most languages have + as left associativity, this applies to OCaml as well.

@TheSpyder
Copy link

isn't this because OCaml ^ is right associative and that's what ++ translates to?

@bobzhang
Copy link
Contributor Author

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

@TheSpyder
Copy link

Sorry, I didn't mean to question why we would change it, just why it ended up this way.

@jordwalke
Copy link
Member

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.

@jordwalke
Copy link
Member

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").

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

3 participants