Since at Bedrock Systems we have multiple Coq repositories, I tried composing builds by putting multiple projects together. Is it correct that, for now, I have to patch the dune builds to have a single dune-project? Is that limitation easier to lift in the future?
Indeed, this is still lacking, but it is a high priority feature.
@Emilio Jesús Gallego Arias Just curious, what's preventing this at the moment, is it just the missing scoping mechanism we have for OCaml libraries? Or is there still some upwork remaining in coq?
Main point to figure out is what the rules for detecting public installed libs are; we cannot rely on ocamlfind as OCaml does. The whole thing is a bit messy, but I think I got a good idea on how to move forward. Anyways I hope in the CUDW we can do a task-force and actually move beyond the current installation layout.
ah. mapping foo.bar to user-theories/foo/bar might not be general.
Yeah, we need to come out with a better setup for libs, unfortunately that won't be compatible with coq-makefile, so i'll be coq lang 2.0
for now yeah, no other choice than to do that kind of mapping :S
which is pretty expensive by the was as Dune has to scan the full of user-contrib
:S
“won’t be compatible with coq_makefile” where’s the roadmap for ever deprecating coq_makefile?
my questions in the last few days amount to significant objections.
if you want to add some library database, then can you add a command that can be used without dune?
to be more explicit, coq_makefile can compose with arbitrary extensions in Makefile.coq.local, while (today) dune allows:
copy_files -R
is already hard (I don’t get why)I’m sure there are reasons, and I asked about them a few days ago (after all, I also use dune)...
If you want each library to install a manifest file in a precise place, then I don't see why coq_makefile cannot be patched to do the same.
... TLDR there’s going to be lots of resistance to a forcing something so limiting, unless you involve users in the decision early on
and not just resistance by inertia
but I’m sure @Théo Zimmermann appreciates the complexities of these “community” decisions :-)
Not sure what you mean by "appreciates" in this context, but I sure agree with you.
appreciate as in “understand well”, but I had a typo (now fixed) :-)
Paolo Giarrusso said:
to be more explicit, coq_makefile can compose with arbitrary extensions in Makefile.coq.local, while (today) dune allows:
- no programming at all in dune (except by generating dune files as text)
- no programming in OCaml except through upstream patches
- no parametric rules
- somehow
copy_files -R
is already hard (I don’t get why)I’m sure there are reasons, and I asked about them a few days ago (after all, I also use dune)...
I don't think lack of programability is a bad thing, indeed I think it is a good thing. For a system such as Coq, I think users should say _what_ to build, not _how_ to do it. That is to say, the dune language should remain declarative.
This is obviously more limited, but on the other hand it provides a better abstraction setup, and in particular it allows developers to change _how_ things are built without impacting users. If you got some very special needs already you can hook dune to your own build system.
The default install layout for Coq packages has a huge downside and it is that once a package is installed, it is not possible to hide it. Already nix is doing things differently and coq dune 2.0 will do too I hope.
A good example of this is instrumentation; imagine I want to build a Coq theory with some instrumentation. If you can program your own build rules, we have little hope to make it work with your setup
Moreover, you can mix OCaml and Coq seamlessly in a single project. Good luck doing that with coq_makefile.
mixing can be done, but it's absolutely terrible to get incremental builds for an extraction-based project (using coq_makefile)
I would probably use Dune with the "submake" functionality if I got stuck somewhere, rather than abandon Dune completely
the sad reality, however, is that many (maybe even most projects outside coq-community and Coq's CI and the contribs) are using completely home-made Makefiles
consider this relatively high-profile project: https://github.com/vrahli/Velisarios/blob/master/Makefile
PBFT/PBFTview_changes_are_received.vo : PBFT/PBFTview_changes_are_received.v PBFT/PBFTview_change_somewhere_in_log.vo
coqc -R coq-tools util -R model model -R components components -R PBFT PBFT -R PrimaryBackup PrimaryBackup -R runtime runtime -R TwoThirds TwoThirds PBFT/PBFTview_changes_are_received.v
Thanks for motivating the design. That makes sense for the coq part. However, I have a program that generates .v files; now what?
“You can hook dune to your build system” how? Right now, I can generate a dune file that lists one rule for each .v file (all copies of the same rule).
@Paolo Giarrusso example of .v
generation: https://github.com/palmskog/fitch/blob/master/coq/dune
Thanks, I have N rules like that — I asked about %.v : %.bar
rules in another thread here
I guess I was thinking of this: https://dune.readthedocs.io/en/stable/foreign-code.html#foreign-build-sandboxing
in any case, there is no need to trade off declarative builds against extensibility.
ah I misunderstood then, I thought it was quite clear the current conclusion seemed to be to use your favorite language to generate the dune rules/files (for %.v: %.bar
)
sure, that’s indeed the workaround :-)
PL researchers trade extensibility against predictability/guarantees all the time, arguably
you can have an extensible system that lets you implement declarative tasks, but also extensions.
indeed, you have tradeoffs in e.g. how dynamic your dependencies can be.
for example, if the majority of users of Dune don't need %.v : %.bar
the right design decision could be to force everyone who does to generate dune files.
@Karl Palmskog my basic answer is “Growing a language”
it’s probably a matter of opinion, but that research program was the foundation of my supervisor’s research program :-)
plenty of examples of successful languages that haven't grown much, if at all
@Karl Palmskog on your example, maybe there’s a couple of users who need that extension, but another couple of users need their own extension, and so on
non-success-story of growing something: browser extensions
no clue on browser extensions (other than, I wouldn’t use a browser without); I agree that there’s plenty of languages that are not extensible enough for users.
so I disagree about the general qualitative argument that "extensions should (always) be possible"
both Chrome and Firefox extensions have died multiple times over, and are consistently broken as browsers evolve
well, I don’t think I’ll convince you, but you won’t convince me either I guess
maybe there could be progress on what makes sense in this example.
and some of the limitations don’t seem about extensibility either.
but is the plan for dune to _not_ offer support for plugins?
but what's the core of your argument? System software should be extensible because... [...] even at the cost of predictability/guarantees/etc.
I didn’t say “system software”
I didn’t say that either
I was giving an example what the argument could look like
users of programming languages (which include build languages) will need to have custom extensions
some could go into the language, but some don’t make sense for all users.
and I don’t think the “predictability” argument applies, since the present limitations prevent things that don’t violate the guarantees.
if you allow full programmability inside Dune in OCaml, what can you guarantee?
I’m not necessarily attached to plugins.
programming language design is a thing, and we have solutions to design languages with restricted side effects.
in Haskell, you could design an embedded DSL and its semantics, and make it as restrictive as you’d like.
if you design an extension DSL and publish a paper proving the usual Dune properties are preserved, I'm sure they will discuss it
I realize that might not be as easy in another language, but I don’t think this part was a problem in SBT...
what _are_ the usual Dune properties?
I’ve asked, a while ago, for a design rationale
you’ve explained a bit more now, but I’ve never seen a design document.
I think this is the closest to a formalization: https://www.staff.ncl.ac.uk/andrey.mokhov/selective-functors.pdf
but if you suggest an extension framework, shouldn't the burden fall on you to formalize the missing parts, if indeed parts are missing?
I mean, I’m not trying to place burdens, I’m asking questions and trying to understand.
I do ask that coq_makefile is left alive
here is the general pen-and-paper formalization of build systems that above paper builds on: https://www.cambridge.org/core/journals/journal-of-functional-programming/article/build-systems-a-la-carte-theory-and-practice/097CE52C750E69BD16B78C318754C7A4 (preprint: https://github.com/snowleopard/build/releases/download/jfp-submission/jpf-submission.pdf)
coq_makefile is not going to go away anytime soon. the most that might happen is that the community starts to maintain it instead of Coq devs
good to hear that — that wasn’t clear above :-)
Coq project build practice evolution is extremely slow
in any case, if that paper formalizes dune, does that mean that newtype Task k v = Task{ run:: forall f . Selective f => (k->f v)->f v}
is the necessary type?
to my understanding, it's general model that at some high level corresponds to the basic ideas behind Dune
more weakly: at a quick look, that paper does explain part of the rationale of dune (static overapproximation), then designs the core of a DSL to support it.
I tried to summarize the status of build system formalization in our TACAS paper: http://users.ece.utexas.edu/~gligoric/papers/PalmskogETAL20Chip.pdf#page=15
that doesn’t seem evidence that abstraction mechanisms in dune scripts prevent its goals.
there’s a gulf between arbitrary computations, and no abstraction.
on the other hand, is there evidence that it will work well? (Be maintainable, used by many users, etc.)
and in-between, there’s “use a pure FP language to generate the dune script with something better than string concatenation”
Well! There are tons of build systems with various amounts of programmability, and tradeoffs between them.
up to now, I don’t think dune has _specific_ problems preventing extensions.
that was my key argument. That doesn’t mean that somebody has to do it for me :-). Worst-case, somebody could build a DSL to generate dune scripts in a nicer way.
Paolo Giarrusso said:
but is the plan for dune to _not_ offer support for plugins?
The plan is to certainly offer plugins. However, we'd prefer to do this by exposing an OCaml based API.
fine with me, tho some of @Karl Palmskog’s question apply to such plugins (how do you enforce the guarantees on them)
right, I'm not sure if it's easy to enforce things like pureness, or at least absence of IO, etc., in OCaml
I guess they might be like ad-hoc axioms in Coq... caveat emptor
Regarding pattern rules as in make: This is just one of many examples where dune's language falls short. We're incredibly hesitant to pile on features on the dune language because we've seen how things like make, cmake, etc have turned out. Ideally, we'd have something like dhall for configuring builds. Unfortunately, there's nothing dhall-like available in the OCaml world, and it's quite a huge task to implement a high quality PL from scratch.
Karl Palmskog said:
right, I'm not sure if it's easy to enforce things like pureness, or at least absence of IO, etc., in OCaml
There were some ideas. In the end, I think we'll just need to provide an API and warn the users not to do any IO outside of it.
One idea was to embed an ocaml interpreter in dune itself (such a thing is already written) and to modify it to only access a primitive standard library that doesn't permit IO. However, it would still be possible to write non terminating program. That's not ideal.
_ahem_
Dhall is based on the Calculus of Constructions, apparently.
and a normalizer.
Yeah, dhall is good. The dependency tree is massive though
I hear a OCaml implementation of CC exist, tho I’ll admit it is not obvious how to repurpose it for the task.
but luckily, I think a few of its authors are available around here.
;-)
ahhh, configuration languages. Has anyone theoretically justified them yet?
To contrast with dhall, check out bazel's skylarg language. :sick:
"inspired by Python3" :fear:
let me be more explicit: in PL terms, ignoring concrete syntax and such details, Dhall is nothing but a small Coq implementation :-)
With good error messages :)
just Gallina, a normalizer, and convenient primitives to write configurations
ohohohoh, shots fired :-)
what do they use dependent types for?
good question, no clue!
guess they wanted something powerful and non-Turing complete
Paolo Giarrusso said:
ohohohoh, shots fired :-)
Ha, I'm not saying coq's bad. Dhall is really going out of it's way to give good error messages.
starting from a clean slate (and no need of DTT), I would implement a language as a subset of CakeML, verified bootstrapped compiler for free
and oh, well, GADTs without hacks
@Paolo Giarrusso I have a prototype ready for a PR
to be included in Dune 2.8
let me know if you would be interested in testing
Hey! I'm slightly swamped, but I am still interested
Ok great, thanks a lot, will send you the branch , if you are using opam doing a new switch [for safety] + opam pin dune
should do the trick.
I'd like to be sure it works in your use case as this is one of the main roadblocks to having a stable version of Coq dune support.
one good test case might be CoqHammer, see discussion here: https://github.com/lukaszcz/coqhammer/issues/92
I commented out the compositional stuff there in preparation of 2.8 (when they can hopefully be commented in)
2 testers sound better — and since CoqHammer's fully open source, I'm sure it's entitled to better support.
(Part of Bedrock's stack is open-source as well, but you really need internal parts to reap the benefits)
@Karl Palmskog I'm a bit confused by that issue, I _do_ use theories
the basic problem is that you want to be able to compose with both local and installed parts
okay, not sure about that
so hopefully this is something Emilio will test
right now I _can_ use theories
but only inside a single dune-project
but I still understand very little of dune :-|, sadly (time is what it is)
to me, full compositional support means you can combine any of: multiple local Git-based projects with their own dune-project
and installed libraries
ah, I thought coq-hammer had all in a single repo
and a single dune-project
?
it does have everything under one dune-project
exactly
but what we want to be possible is that a user can have, say, coq-hammer-tactics
installed, and then build the plugin locally - and also at the same time allow building both components from scratch (without changing the build scripts)
ah, I misread
I see — for now theories
_forces_ building everything together, and you don't want that
right now, if I have (theories Hammer.Tactics)
then I cannot have coq-hammer-tactics
installed
Great, we will try with Coq Hammer too, thanks; as of now I haven't implemented support for user-contrib
yet, doing that properly is a bit annoying as you need to walk the filesystem "on-demand" as otherwise resolution could get very expensive on large installed bases, but will get to it
but indeed, at best, detecting things in user-contrib will remain, at best, a heuristic, until we move to a per-package solution
I’d already be happy with not removing dune-project files
Hm, I'm wondering if https://dune.readthedocs.io/en/stable/usage.html#finding-the-root means one could get compositional builds across multiple dune-project by adding a dune-workspace file... But I'm confused, since those docs spell out rules for finding dune-workspace, but the rules for dune-project are not specified and seem different?
Strictly speaking, these two sentences seem contradictory:
The root of the current workspace is determined by looking up a dune-workspace or dune-project file in the current directory and parent directories.
More precisely, it will choose the outermost ancestor directory containing a dune-workspace file as root.
Are they? IIRC, it is always possible to drop a dune project in a subfolder of another dune project or even to combine several dune projects by putting them in multiple subfolders and creating a dune-workspace at the root.
but that’s not what the text is saying
The second sentence specifies, unambiguously, that the root is determined by looking up dune-workspace
. Of course that’s mistaken.
The first sentence uses a disjunction, and doesn’t specify the priority between dune-project and dune-workspace.
Finally, I’ve composed coq builds using dune-project, but I’ve had to remove the dune-project of the inner project to make it work. I know that’s because Coq compositional builds aren’t fully supported yet, but that doesn’t help me form a mental picture.
The background is me complaining that the dune manual is obscure, giving it another chance, and running into issues within the first five minutes.
Last updated: Oct 13 2024 at 01:02 UTC