ocaml / ocaml/dune

[coq] auto-infer plugins field

Open
#7,913 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

rocq
Dominant language
OCaml
Stars
1.9k
Forks
500
Avg merge
15h 21m
Merged PRs (30d)
277

Description

From Coq 8.16 onwards, the plugins field of the coq.theory stanza could be auto-inferred.

  1. We find any .v files that do "Declare ML Module".
  2. We parse the public_name of the library that is declared.
  3. We add this automatically to the list of plugins.

This is only possible from 8.16 onwards as we started using findlib to load plugins. Older versions will not have the plugin names so we need to stay at the current behaviour for those.

This is only about inferring the plugins in the coq.theory stanza and not inferring the plugins in any dependencies. As of writing, Dune is not able to infer the plugins needed from dependencies and this is a bug #7893. The behaviour I am describing here means that a user only has to include a "Declare ML Module" in a .v file rather than having to write them out in the stanza.

We should also work out how we want this to interact with dune coq top. I am not sure we are going to be able to interactively build plugins when they are loaded and these declare statements will have to live in existing .v files. This could be annoying.

It should still be possible for users to declare a plugins field however and we have to work out if this should override or complement the inferred plugins.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the coq.theory stanza handles its plugins field and how dune coq top loads plugins. Determine how Declare ML Module entries in .v files should be discovered for Coq 8.16 and newer while preserving current behavior for older versions. Resolve whether explicit plugins complement or override inferred ones, and account for the dependency limitation described in issue #7893.

Written by the indexing model from the issue text.

Assessment

Tech stack
ocaml
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.