[coq] Deprecate public_name field in favor of package.#2087
[coq] Deprecate public_name field in favor of package.#2087rgrinberg merged 1 commit intoocaml:masterfrom
Conversation
50a9ea4 to
660b9b2
Compare
|
cc: @Zimmi48 ; for future version of the coq language we could indeed drop compatibility with Coq makefile, then installing the corresponding Even so, the question on whether we should allow libraries names of the form I dunno, the form of namespacing as used in the OCaml world should maybe something that Coq itself should be aware of. |
|
I think it is OK to be stricter on what we accept. A Dune package should be packed under a single namespace, and this is already what is conventionally done in Coq packages. |
In the 2.0 version of the language we could allow fancier rules; the current rules for Coq makefile install everything under a global directory [which can be several if you use COQPATH, but that is still one for Coq]. This is a bit inconvenient, as for example there are no proper ways to compartmentalize nested libs. Something that bothers me is that we identifiy the module namespace with the library name. IMHO these are two conceptually different things, however I am not sure under this "1.0" scheme we can do better; after all, all that Dune can query is the directory tree on So yeah, even in the version 1.0 of the language it is not clear what a library identifier should be. For example, using this convention we cannot install two libraries that provide the module namespace I think that a good start for a "2.0" version of the Coq language would be to adopt a 2-level similar naming scheme as in OCaml. Thus, a library that is declared In the end I dunno, it is hard to know how things are going to work out until we don't try more; we don't have a lot of experience in this Coq context I'm afraid. |
660b9b2 to
2e1f0eb
Compare
|
How can you, in OCaml, depend on two packages that provide modules under the same namespace? I personally feel like this is a very good practice to use namespaces that are reminiscent of the package name for less ambiguity. If you want a |
Oh, then we can go with this proposal to identify package name with its namespace for now. In OCaml you cannot depend on two packages that provide the same namespace, but you can have indeed have virtual modules so for example, for namespace That works because they are properly installed, however in the current Coq setup we cannot do that with the global namespace that is forced. The moment we break this discipline dune-produced packages cannot be use by |
rgrinberg
left a comment
There was a problem hiding this comment.
The implementation looks fine to me. I have nothing to recommend, but it certainly seems like namespaces and library names are separate concepts. Regarding the installation and keeping namespaces "open", perhaps the OCaml namespace proposal for some inspiration? https://github.com/lpw25/namespaces
Good point. I now understand what you mean by breaking compatibility and how we could wish to follow this route in the future. Virtual libraries are a nice concept that I would hope to support in the future (but we are far from it as we don't have interface files yet). |
2e1f0eb to
767b349
Compare
Yeah maybe virtual libraries are not the best name, but indeed with the current compat constraints we cannot do better. It is very unfortunate we cannot allow a better install for now. I am not very comfortable going this way, but as long as we want to support the legacy install method I guess we'll have to leave with this. So let's make the 1.0 version use module names as namespaces and see what kind of workflow does people have. In fact, as soon as Coq itself is moved to dune we could have the 1.1 version of the language with slightly more sensible rules. |
767b349 to
30e2400
Compare
1bb903e to
2beacc5
Compare
2beacc5 to
37a658f
Compare
37a658f to
5f48078
Compare
bf32712 to
bbad79d
Compare
rgrinberg
left a comment
There was a problem hiding this comment.
Reviewed again and it looks fine.
|
Ready to merge IMO, thanks @rgrinberg |
In the current model, Coq theory names can be of the form `A.b.C`, which does mean that modules do live under that module prefix. This poses a problem for handling `public_name` in a sensible way if we want to allow globally-installed theories to satisfy local dependencies. Imagine the following theory declaration: ```lisp (coq.theory (name mow) (theories foo.bar)) ``` How should we satisfy `foo.bar`? Indeed, there is an ambiguity, does it mean, "theory `bar` in package `foo`" or "theory `bar.foo`" in the current package. In particular, we could have a local stanza of the following form: ``` (coq.theory (name bar) (public_name foo.bar)) ``` but then it would not be stable under vendoring, as this library would be installed in `user-contrib/bar`. And moreover, it is ambiguous with: ``` (coq.theory (name foo.bar)) ``` One solution is to forbid the use of `public_name` and prefer `package` instead. This way, libraries live under a global namespace and the problem is solved. However, this is not very satisfying, and the problem in future versions of the language would still remain. Thus I am not very convinced by this solution; suggestions are welcome. This is a pre-requisite for ocaml#2053 Signed-off-by: Emilio Jesus Gallego Arias <e+git@x80.org>
bbad79d to
e27089e
Compare
…lugin, dune-private-libs and dune-glob (2.3.0) CHANGES: - Improve validation and error handling of arguments to `dune init` (ocaml/dune#3103, fixes ocaml/dune#3046, @shonfeder) - `dune init exec NAME` now uses the `NAME` argument for private modules (ocaml/dune#3103, fixes ocaml/dune#3088, @shonfeder) - Avoid linear walk to detect children, this should greatly improve performance when a target has a large number of dependencies (ocaml/dune#2959, @ejgallego, @aalekseyev, @Armael) - [coq] Add `(boot)` option to `(coq.theories)` to enable bootstrap of Coq's stdlib (ocaml/dune#3096, @ejgallego) - [coq] Deprecate `public_name` field in favour of `package` (ocaml/dune#2087, @ejgallego) - Better error reporting for "data only" and "vendored" dirs. Using these with anything else than a strict subdirectory or `*` will raise an error. The previous behavior was to just do nothing (ocaml/dune#3056, fixes ocaml/dune#3019, @voodoos) - Fix bootstrap on bytecode only switches on windows or where `-j1` is set. (ocaml/dune#3112, @xclerc, @rgrinberg) - Allow `enabled_if` fields in `executable(s)` stanzas (ocaml/dune#3137, fixes ocaml/dune#1690 @voodoos) - Do not fail if `ocamldep`, `ocamlmklib`, or `ocaml` are absent. Wait for them to be used to fail (ocaml/dune#3138, @rgrinberg) - Introduce a `strict_package_deps` mode that verifies that dependencies between packages in the workspace are specified correctly. (@rgrinberg, ocaml/dune#3117)
…lugin, dune-private-libs and dune-glob (2.3.0) CHANGES: - Improve validation and error handling of arguments to `dune init` (ocaml/dune#3103, fixes ocaml/dune#3046, @shonfeder) - `dune init exec NAME` now uses the `NAME` argument for private modules (ocaml/dune#3103, fixes ocaml/dune#3088, @shonfeder) - Avoid linear walk to detect children, this should greatly improve performance when a target has a large number of dependencies (ocaml/dune#2959, @ejgallego, @aalekseyev, @Armael) - [coq] Add `(boot)` option to `(coq.theories)` to enable bootstrap of Coq's stdlib (ocaml/dune#3096, @ejgallego) - [coq] Deprecate `public_name` field in favour of `package` (ocaml/dune#2087, @ejgallego) - Better error reporting for "data only" and "vendored" dirs. Using these with anything else than a strict subdirectory or `*` will raise an error. The previous behavior was to just do nothing (ocaml/dune#3056, fixes ocaml/dune#3019, @voodoos) - Fix bootstrap on bytecode only switches on windows or where `-j1` is set. (ocaml/dune#3112, @xclerc, @rgrinberg) - Allow `enabled_if` fields in `executable(s)` stanzas (ocaml/dune#3137, fixes ocaml/dune#1690 @voodoos) - Do not fail if `ocamldep`, `ocamlmklib`, or `ocaml` are absent. Wait for them to be used to fail (ocaml/dune#3138, @rgrinberg) - Introduce a `strict_package_deps` mode that verifies that dependencies between packages in the workspace are specified correctly. (@rgrinberg, ocaml/dune#3117) - Make sure the `@all` alias is defined when no `dune` file is present in a directory (ocaml/dune#2946, fix ocaml/dune#2927, @diml)
…lugin, dune-private-libs and dune-glob (2.3.0) CHANGES: - Improve validation and error handling of arguments to `dune init` (ocaml/dune#3103, fixes ocaml/dune#3046, @shonfeder) - `dune init exec NAME` now uses the `NAME` argument for private modules (ocaml/dune#3103, fixes ocaml/dune#3088, @shonfeder) - Avoid linear walk to detect children, this should greatly improve performance when a target has a large number of dependencies (ocaml/dune#2959, @ejgallego, @aalekseyev, @Armael) - [coq] Add `(boot)` option to `(coq.theories)` to enable bootstrap of Coq's stdlib (ocaml/dune#3096, @ejgallego) - [coq] Deprecate `public_name` field in favour of `package` (ocaml/dune#2087, @ejgallego) - Better error reporting for "data only" and "vendored" dirs. Using these with anything else than a strict subdirectory or `*` will raise an error. The previous behavior was to just do nothing (ocaml/dune#3056, fixes ocaml/dune#3019, @voodoos) - Fix bootstrap on bytecode only switches on windows or where `-j1` is set. (ocaml/dune#3112, @xclerc, @rgrinberg) - Allow `enabled_if` fields in `executable(s)` stanzas (ocaml/dune#3137, fixes ocaml/dune#1690 @voodoos) - Do not fail if `ocamldep`, `ocamlmklib`, or `ocaml` are absent. Wait for them to be used to fail (ocaml/dune#3138, @rgrinberg) - Introduce a `strict_package_deps` mode that verifies that dependencies between packages in the workspace are specified correctly. (@rgrinberg, ocaml/dune#3117) - Make sure the `@all` alias is defined when no `dune` file is present in a directory (ocaml/dune#2946, fix ocaml/dune#2927, @diml)
In the current model, Coq theory names can be of the form
A.b.C,which does mean that modules do live under that module prefix.
This poses a problem for handling
public_namein a sensible way ifwe want to allow globally-installed theories to satisfy local
dependencies.
Imagine the following theory declaration:
How should we satisfy
foo.bar? Indeed, there is an ambiguity, doesit mean, "theory
barin packagefoo" or "theorybar.foo" in thecurrent package.
In particular, we could have a local stanza of the following form:
but then it would not be stable under vendoring, as this library would
be installed in
user-contrib/bar. And moreover, it is ambiguouswith:
One solution is to forbid the use of
public_nameand preferpackageinstead. This way, libraries live under a global namespaceand the problem is solved.
However, this is not very satisfying, and the problem in future
versions of the language would still remain. Thus I am not very
convinced by this solution; suggestions are welcome.
This is a pre-requisite for #2053