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

Default modalities and simple modal modules #97

Open
wants to merge 5 commits into
base: jane
Choose a base branch
from

Conversation

tdelvecchio-jsc
Copy link

Enables adding @@ portable at the top of an mli file (and at the beginning of sig ... end blocks), as well as marking module declarations with modes:

@@ portable

val portable : unit -> unit
val nonportable : unit -> unit @@ nonportable

module (T @ nonportable) : sig @@ portable
  val portable : unit -> unit
  val nonportable : unit -> unit @@ nonportable
end

This is enough to get us started adding portability to our code, though there is more syntax to implement in the future.

Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Signed-off-by: Thomas Del Vecchio <[email protected]>
Comment on lines +1 to +3
@@ moda1 moda2

(** cmt *)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be easy to keep the doc comment at the beginnig of the file? It's common to have a large documentation comment that gives a high-level description of the interface at the top of an mli, and I think it would be better not to have to push it down.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That unfortunately is not currently syntactically valid, and I had to do a hack to even get this to work. See diff at https://github.com/janestreet/ocamlformat/pull/97/files#diff-cae07aad219a479660ff7234c7aab435a1cd1791e66cf33d3763f37c12a5f3acR674

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.

2 participants