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

[RFC] Opt-in generation of empty interfaces of modules without .mli ? #4952

Closed
nojb opened this issue Sep 29, 2021 · 7 comments · Fixed by #4955
Closed

[RFC] Opt-in generation of empty interfaces of modules without .mli ? #4952

nojb opened this issue Sep 29, 2021 · 7 comments · Fixed by #4955

Comments

@nojb
Copy link
Collaborator

nojb commented Sep 29, 2021

When a module is used solely for their side-effects, one typically wants to add an empty interface file to benefit from the various "unused" warnings, faster incremental compilation, etc.

In our case we have some libraries where we have dozens and dozens of such files. It would be nice if we could have dune generate the empty interface files on demand, eg having a field (modules_without_interface ...) that would tell dune to generate empty interface files for the listed modules (both in libraries and executables).

(In case you are curious, we currently patch the compiler to avoid having to actually create all these empty interfaces, but it seems like a task that would fit nicely to Dune.)

Opinions?

@nojb
Copy link
Collaborator Author

nojb commented Sep 29, 2021

xref #3768

@nojb
Copy link
Collaborator Author

nojb commented Sep 29, 2021

See also the second bullet point in https://discuss.ocaml.org/t/dealing-with-warning-70-missing-mli/8542 where a similar need is expressed.

@bobot
Copy link
Collaborator

bobot commented Sep 29, 2021

I think it would be nice. Perhaps another name (modules_with_empty_interface ...). Perhaps even more useful would be a mode where dune automatically put an empty interface if there is no .mli : something like (modules_without_interface_are_empty)

@nojb
Copy link
Collaborator Author

nojb commented Sep 29, 2021

I think it would be nice. Perhaps another name (modules_with_empty_interface ...). Perhaps even more useful would be a mode where dune automatically put an empty interface if there is no .mli : something like (modules_without_interface_are_empty)

Yes, this would work for me as well.

@ghost
Copy link

ghost commented Sep 29, 2021

For me, "empty module" means "struct end".

@nojb
Copy link
Collaborator Author

nojb commented Sep 29, 2021

For me, "empty module" means "struct end".

What about (empty_module_interface_if_absent) ? Anyway, regardless of the exact name, is there agreement on the general feature?

@ghost
Copy link

ghost commented Sep 29, 2021

The general feature seems fine to me. (empty_module_interface_if_absent) makes sense to me.

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 a pull request may close this issue.

2 participants