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

Add support for the OCaml object language #13

Closed
jberdine opened this issue Oct 20, 2017 · 2 comments
Closed

Add support for the OCaml object language #13

jberdine opened this issue Oct 20, 2017 · 2 comments

Comments

@jberdine
Copy link
Collaborator

The object language of OCaml is largely unimplemented. Designing the formatting of these constructs would be best done by someone with a lot of experience with them, who knows the readability pitfalls to avoid, etc.

@emillon
Copy link
Collaborator

emillon commented Nov 14, 2017

A non-intrusive first step could be to support the a#b syntax. That would support code that uses object APIs without too much effort. My best guess is that a#b can be formatted with the same rules as a.b, but this is just a suggestion.

smondet added a commit to smondet/ocamlformat that referenced this issue Jan 30, 2018
Just like the `Pexp_field _` one.
Cf. **@emillon**'s [comment][1] on ocaml-ppx#13.

```ocaml
  let f x = (x ()).contents

  let x obj = obj#hello ()

  let x obj_f = (obj_f ())#hello ()

  let f obj = obj#hello_some_pretty_long_one ~with_labels:true ()

  let f obj =
    obj#hello_some_pretty_long_one ~with_labels:true
      "desjd\n\
       dijsde\n" {md|
In **markdown**
|md}
```

[1]: ocaml-ppx#13 (comment)
jberdine pushed a commit that referenced this issue Feb 1, 2018
smondet added a commit to smondet/ocamlformat that referenced this issue Feb 2, 2018
jberdine pushed a commit that referenced this issue Feb 3, 2018
smondet added a commit to smondet/ocamlformat that referenced this issue Mar 28, 2018
smondet added a commit to smondet/ocamlformat that referenced this issue Mar 29, 2018
jberdine pushed a commit that referenced this issue Mar 30, 2018
@hhugo
Copy link
Collaborator

hhugo commented Apr 26, 2018

Fyi, I'm working on this.

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