-
Notifications
You must be signed in to change notification settings - Fork 180
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
Please reconsider multiline deprecations #1997
Comments
Hi, there are multiple reasons as to why we are deprecating all these options:
To fix most of these problems we are heading towards a different direction (not official yet, hence why the current options are not yet removed) which is to only allow ocamlformat to be customized by profiles, that would all have their own specificities:
Personally I would like to add a profile that is diff-friendly, something always expands the code vertically to minimize the number of impacted lines when bits are added/removed, in the spirit of Also see #1923 |
Thank you. I'll close this then. Please consider waiting until there's a viable alternative before removing |
I second the request to wait on removing these options. Though I haven't looked at the profiles in detail recently, in the past the profiles were not diff-friendly. I mostly use a diff-friendly style, and I'd like to avoid these removals impacting that too greatly. To give a concrete example, I prefer for the let () =
if true then
()
else
() Of the remaining non-deprecated options, let () = if true then () else () (I separately also almost never want this output for legibility reasons, regardless of diffs). This output remains diff-unfriendly if one of the cases gets longer, but not the other, because they will try to do if true then
...
else () (* diff entanglement between else keyword and () *) I'd be happy to contribute to a profile, or contribute a profile, once ocamlformat makes the switch. |
Dream was using some of the removed options based on misconceptions about what they did. Others seem to have good substitutes among the remaining options. For if-then-else = fit-or-vertical, see ocaml-ppx/ocamlformat#1997 (comment)
I opened #2020, don't hesitate to give some feedback if you have time to give it a try! |
Please preserve at least the Also, earlier:
This ship sailed 20 years ago. It'd be nice to have one universal style but it will never happen (or would you consider removing the janestreet style, for example? I don't think so). This kind of thing needs to be there from day 1, not year 25, it's not a realistic objective in 2022. |
I think if you're going to be moving in the direction of profiles, it probably makes sense to add the profiles of prolific community members such as @c-cube and @antron as well. Look at the community members who wrote a lot of code on opam and give them a chance to come up with their own profile. Ultimately you're probably going to have to factor out the common patterns between these profiles anyway, so that you'll leave only the options these profiles use (similar to yapf for python). You can then have configurations such as "@c-cube + if-then=X", which is exactly what yapf does. |
I am currently using four options which were deprecated in recent commits, which make me wary of upgrading beyond version 0.19:
function-indent-nested = auto
Deprecate option 'function-indent-nested' #1898if-then-else = fit-or-vertical
Deprecate values 'fit-or-vertical' and 'k-r' for option 'if-then-else' #1899indicate-multiline-delimiters = closing-on-separate-line
Deprecate value 'closing-on-separate-line' for option 'indicate-multiline-delimiters' #1900 Feature request: Update default profile to use indicate-multiline-delimiters = closing-on-separate-line #1958match-indent-nested = auto
Deprecate option 'match-indent-nested' #1905I can live without
if-then-else
if I must (big adjustment, but I can see the appeal), and I'm not sure whatfunction-indent-nested
andmatch-indent-nested
actually do anymore, but particularly painful to me would be losingclosing-on-separate-line
which makes things much easier to read and especially edit/diff. I get that LISPy languages save a line by closing on the last line, but I don't really see OCaml as a LISP. 😉There was no explanation with the pull requests themselves so I'd like to take this opportunity to ask: are they deprecated because they are covered by other options or recent default behavior, or because too few people use them? Would a bounty help resuscitate
indicate-multiline-delimiters
in particular?The text was updated successfully, but these errors were encountered: