Skip to content

[RFC] Remove bitrotten Reason support#254

Closed
jberdine wants to merge 1 commit intomasterfrom
rm-reason
Closed

[RFC] Remove bitrotten Reason support#254
jberdine wants to merge 1 commit intomasterfrom
rm-reason

Conversation

@jberdine
Copy link
Copy Markdown
Collaborator

@jberdine jberdine commented Aug 1, 2018

This PR is a request for comments from potential users of the Reason conversion support. The support for converting Reason to OCaml has not been actively used or maintained for a year. Much has changed in that time, not to mention that ocamlformat depends on an old version of reason. Unless someone steps forward to actively maintain this functionality, it makes more sense to remove it for the time being.

@hhugo
Copy link
Copy Markdown
Collaborator

hhugo commented Aug 7, 2018

Copy-pasting comment from @osener

Re: #254, I think it is fair to remove Reason support from ocamlformat. I had tried using refmt to convert Reason sources to OCaml (and going the other way) a while back and saw some loss of syntax sugar such as let%lwt

I just tried again, this time using ocamlformat and refmt together, and it works really well except the annotations Refmt inserts such as [@reason.raw_literal ...] and [@explicit_arity]. If Refmt provides an option to disable those, something like the command below would be almost lossless:

refmt --parse=ml --print=re source.ml | refmt --parse=re --print=ml | ocamlformat

@hhugo
Copy link
Copy Markdown
Collaborator

hhugo commented Aug 7, 2018

@jberdine, do you want to merge this based on the comment above ?

@jberdine
Copy link
Copy Markdown
Collaborator Author

jberdine commented Aug 7, 2018

I'm wary of the reason support being something like false advertising. Basically I don't currently have a use for the Reason conversion, and don't use it, and don't have time to fix the bugs that must be in it. On the other hand, it might be more approachable to someone who wants to get it working to leave the code there. Maybe it would be enough to be more explicit that it is there, but untested and largely unsupported?

@jberdine
Copy link
Copy Markdown
Collaborator Author

jberdine commented Aug 7, 2018

(Replying to #289 (comment) but keeping the discussion here.)

It is not so much work to keep the existing code in the repo, and to keep it compiling. It would be a lot of work to test it. I think it would also likely take some work to keep up to date with changes to refmt, which is a moving target, and ocamlformat's Reason to OCaml conversion support relies tightly on one of refmt's internal representations. (The way ocamlformat_reason works is to pipe a binary serialized internal representation from refmt to ocamlformat.)

The last I used ocamlformat_reason, it handled comments and things like explicit_arity reasonably well, much better than outputting ocaml from refmt (which uses Pprintast from ocaml's compiler-libs) and then reformatting that ocaml.

But ok, it seems that the best plan is to not remove this code for now.

@hcarty
Copy link
Copy Markdown
Contributor

hcarty commented Aug 7, 2018

I'm willing to help at least with the testing side of it. I think it's better for both Reason and OCaml to have a reasonably clean two way conversion process. Having Reason -> OCaml provides an escape hatch for OCaml users who experiment with Reason (lowering the risk involved in trying out Reason's syntax).

@jordwalke who may be interested in chiming in and/or may know someone who could help with maintenance.

@jberdine
Copy link
Copy Markdown
Collaborator Author

jberdine commented Aug 7, 2018

@hcarty it would be great to have some help testing! Even just if someone pays attention to whether it gets broken would be helpful.

I agree about lowering the risk to try Reason, I just can't dedicate the time to it.

@jberdine jberdine removed this from the 0.7 milestone Aug 7, 2018
@jberdine jberdine closed this Aug 7, 2018
@jberdine jberdine deleted the rm-reason branch August 8, 2018 13:44
@gpetiot
Copy link
Copy Markdown
Collaborator

gpetiot commented Oct 31, 2019

We are thinking again about removing the Reason code.
@osener: Now that the Reason ecosystem is more mature, is there a better way to achieve what you wanted outside of ocamlformat?

emillon added a commit to emillon/ocamlformat that referenced this pull request Dec 11, 2019
As discussed in ocaml-ppx#254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
@emillon emillon mentioned this pull request Dec 11, 2019
emillon added a commit to emillon/ocamlformat that referenced this pull request Dec 11, 2019
As discussed in ocaml-ppx#254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
emillon added a commit to emillon/ocamlformat that referenced this pull request Dec 12, 2019
As discussed in ocaml-ppx#254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
gpetiot pushed a commit to emillon/ocamlformat that referenced this pull request Dec 13, 2019
As discussed in ocaml-ppx#254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
gpetiot pushed a commit that referenced this pull request Dec 13, 2019
As discussed in #254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
Julow added a commit to Julow/opam-repository that referenced this pull request Jan 28, 2020
CHANGES:

#### New features

  + Add an option `--margin-check` to emit a warning if the formatted output exceeds the margin (ocaml-ppx/ocamlformat#1110) (Guillaume Petiot)
  + Preserve comment indentation when `wrap-comments` is unset (ocaml-ppx/ocamlformat#1138, ocaml-ppx/ocamlformat#1159) (Jules Aguillon)
  + Improve error messages (ocaml-ppx/ocamlformat#1147) (Jules Aguillon)
  + Display standard output in the emacs plugin even when ocamlformat does not fail (ocaml-ppx/ocamlformat#1189) (Guillaume Petiot)

#### Removed

  + Remove `ocamlformat_reason` (ocaml-ppx/ocamlformat#254, ocaml-ppx/ocamlformat#1185) (Etienne Millon).
    This tool has never been released to opam, has no known users, and overlaps
    with what `refmt` can do.
  + Remove `ocamlformat-diff` (ocaml-ppx/ocamlformat#1205) (Guillaume Petiot)
    This tool has never been released to opam, has no known users, and overlaps
    with what `merge-fmt` can do.

#### Packaging

  + Work with base v0.13.0 (ocaml-ppx/ocamlformat#1163) (Jules Aguillon)

#### Bug fixes

  + Fix placement of comments just before a '|' (ocaml-ppx/ocamlformat#1203) (Jules Aguillon)
  + Fix build version detection when building in the absence of a git root (ocaml-ppx/ocamlformat#1198) (Anil Madhavapeddy)
  + Fix wrapping of or-patterns in presence of comments with `break-cases=fit` (ocaml-ppx/ocamlformat#1167) (Jules Aguillon)
    This also fixes an unstable comment bug in or-patterns
  + Fix an unstable comment bug in variant declarations (ocaml-ppx/ocamlformat#1108) (Jules Aguillon)
  + Fix: break multiline comments (ocaml-ppx/ocamlformat#1122) (Guillaume Petiot)
  + Fix: types on named arguments were wrapped incorrectly when preceding comments (ocaml-ppx/ocamlformat#1124) (Guillaume Petiot)
  + Fix the indentation produced by max-indent (ocaml-ppx/ocamlformat#1118) (Guillaume Petiot)
  + Fix break after Psig_include depending on presence of docstring (ocaml-ppx/ocamlformat#1125) (Guillaume Petiot)
  + Remove some calls to if_newline and break_unless_newline and fix break before closing brackets (ocaml-ppx/ocamlformat#1168) (Guillaume Petiot)
  + Fix unstable cmt in or-pattern (ocaml-ppx/ocamlformat#1173) (Guillaume Petiot)
  + Fix location of comment attached to the underscore of an open record (ocaml-ppx/ocamlformat#1208) (Guillaume Petiot)
  + Fix parentheses around optional module parameter (ocaml-ppx/ocamlformat#1212) (Christian Barcenas)
  + Fix grouping of horizontally aligned comments (ocaml-ppx/ocamlformat#1209) (Guillaume Petiot)
  + Fix dropped comments around module pack expressions (ocaml-ppx/ocamlformat#1214) (Jules Aguillon)
  + Fix regression of comment position in list patterns (ocaml-ppx/ocamlformat#1141) (Josh Berdine)
  + Fix: adjust definition of Location.is_single_line to reflect margin (ocaml-ppx/ocamlformat#1102) (Josh Berdine)

#### Documentation

  + Fix documentation of option `version-check` (ocaml-ppx/ocamlformat#1135) (Wilfred Hughes)
  + Fix hint when using `break-separators=after-and-docked` (ocaml-ppx/ocamlformat#1130) (Greta Yorsh)
bogdan2412 pushed a commit to bogdan2412/ocamlformat that referenced this pull request Mar 28, 2020
As discussed in ocaml-ppx#254, keeping this functionality around is not very
useful:

- it has never been released on opam
- it has no known users
- `refmt` can already emit ocaml code

There are limitations with `refmt`, but workarounds should be
implemented there, not as an unrelated tool in `ocamlformat`.
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.

5 participants