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

Style suggestion: Don't treat not as a special case. #2640

Open
polytypic opened this issue Dec 31, 2024 · 4 comments
Open

Style suggestion: Don't treat not as a special case. #2640

polytypic opened this issue Dec 31, 2024 · 4 comments

Comments

@polytypic
Copy link

polytypic commented Dec 31, 2024

Current formatting (tested with version 0.27.0) treats the not operation differently from other unary functions in some contexts:

let foo () = bax (bay ()) && baz ()
let foo () = (not (bay ())) && baz ()

What I'd prefer is to not treat not as a special case:

let foo () = bax (bay ()) && baz ()
let foo () = not (bay ()) && baz ()

I just don't find this more difficult to read.

To me the extra parentheses in (not x) && y just appear noisy.

@v-gb
Copy link
Contributor

v-gb commented Jan 6, 2025

As a random user, I agree. ocamlformat's choice is highly unconventional, in that I have never seen anyone write such parens even once, nor any confusion resulting from the lack of parens.

@hhugo
Copy link
Collaborator

hhugo commented Jan 6, 2025

I think the special handling was requested by @mshinwell at some point

@hhugo
Copy link
Collaborator

hhugo commented Jan 6, 2025

see #266 (comment)

@hhugo
Copy link
Collaborator

hhugo commented Jan 6, 2025

and some discussion in #686

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants