Regarding the recent impasse with coqmod vs coqdep, I have an idea that might let us side step all these issues. To summarize the current problem:
On one hand, we need an improved dependency analysis tool to improve's dune support for coq. On the other hand, we don't want to dump an independent tool into the coq repo that's duplicating half of what coqdep is already doing.
Each side brings valid points:
Basically, there seems to be no way to keep both sides happy. So how about this compromise:
We start the development of coqmod in dune itself. There we can modify it rapidly to meet dune's needs without disturbing anyone. Once we're confident about the implementation (we can at least build the coq-universe with it), we can submit a proposal for official inclusion in coq. At that point, we should of course re-implement the old coqdep on top of the new lexer.
As a bonus, this proposal has a non trivial performance benefit. We remove all the overhead of running additional binaries this way. It's something I've always wanted to experiment with ocamldep, but never got the time to :)
Can you share pointers? I'm not even aware of the existence of Coqmod.
Sure, this PR started the discussion https://github.com/coq/coq/pull/16153
IIUC, this proposal doesn't seem to improve on this point from Emilio (https://github.com/coq/coq/pull/16153#issuecomment-1152370246), in fact it makes lexer updates harder since they're cross repo (IIUC?)
Having two tools that provide conflicting dependency information is not a good idea. It is indeed not related to coqmod per-se, but really about avoiding the situation where developers have to deal with two lexers when updating the language.
I guess the point is letting coqmod stay experimental for a while, allowing it to break?
new bugs in coqdep seem unlikely not reach users given Coq’s testsuite — but in your proposal you could iterate on coqmod much faster, IIUC
If the above is correct, here are my actual 2 cents:
as a user, it seems safer if dune can keep using coqdep until coqmod stabilizes and is upstreamed, so that dune's coq support will not regress.
Having the coqmod option sounds useful, as soon as it is stable enough and avoids the terrible coqdep performance in Coq 8.15
meanwhile, does this affect the plans to speed up coqdep by running it once per-theory, as Emilio had proposed? If that were delayed, from a user’s POV, it might seem an instance of “the perfect is the enemy of the good”. Even with the improvement Emilio already did, this is still unfortunate. EDIT: this is OT here, I posted on the other thread
Thanks for the pointer. I think duplication of lexing code is minor compared to duplication of handling of -R and company. If coqmod does not resolve to files, then the logic must be duplicated in dune.
This is very worrying, the fact that rules for .v files are hardwired and not overrideable was a major pain when we changed the way cmxs are loaded: I wrote a crapload of compat code to unentangle the release of coq and dune.
If the reason for developing coqmod is to speed things up, then the other path of calling coqdep once is way more reasonable to me.
Let me be clear that coqmod
will not know about -Q and -R, that is up to Dune to resolve (which it already does today). coqmod
will simply report any statement that generates a dependency.
coqmod
reports From X Require A
, then Dune will need to do a resolution of X
and then search for A
.coqmod
reports Require A
then Dune just needs to find A.coqmod
reports Decalre ML Module "foo"
then Dune needs to search for an OCaml module. coqmod
reports Load "file.v"
, then Dune will search for this file. (this is if we keep wanting to support this in Coq).coqmod
reports From X Require Extra Dependency "asdf".
we have to do something else.coqmod
will supply the first part, Dune will resolve the second.
Why do we want coqmod
at all if coqdep
does all of this for us?
The answer is that coqdep
simply does too many things at once:
All of this work, if done per file, is mostly wasted work. Enrico suggests calling coqdep only once, this is possible but it comes at a cost. It does not scale well. If you have a large amount of .v files, coqdep will have to lex each and everyone of them to work out all the dependencies. So if you change a source file, you will have to do the lexing step again and again for everything.
What we can do is make the lexing step separate, this is what coqmod started off as. Now Dune can call coqmod incrementally for each .v file without having to lex the entire file system. coqmod will then report the statements I detailed above to Dune, and then Dune, which knows how to find files, will handle all the dependencies and flags passed to coqc/coqdoc/etc.
When separating the lexing step from coqdep, I noticed there are some poor properties. For instance, newlines were being eaten at random by the lexer, without reporting them to Lexing.lexbuf. This means that there was no good (ln/col) positional data for errors, only char count. Therefore I wrote the entire lexer from the beginning, carefully making sure that the locations work nicely.
Now as any programmer, I am somewhat confident in my own work, but I am not confident enough to shove my lexer into everybodys face by making coqdep use it. This is why I told Emilio that I do not want to share the lexer with coqdep... for the moment.
It appears natural to me for the time being, to take the coqmod tool upstream to Dune, where it can be more quickly iterated and improved together with thing it is designed for. Later, we can bring the polished result downstream to Coq, and if needed factor coqdep through coqmod.
Regarding why I chose a separate binary instead of just a coqdep -modules
mode. This way, we wouldn't have to care about versioning. coqmod
would also work with older versions of Coq. In fact, the more I think about it, the more sense it makes to completely split coqmod
from the Coq release cycle.
I think you folks are turning something easy (sharing a lexer) into a much more complex and unrelated discussion.
Refactoring of logic for file resolution should also happen and be shared by Dune, but that's a separte concern.
If the coqmod
lexer is not good to use by coqdep
, how it is good to be used on its own then?
Ali Caglayan said:
Let me be clear that
coqmod
will not know about -Q and -R, that is up to Dune to resolve (which it already does today).
@Ali Caglayan , how does Dune resolves deps today? It does not, and as @Enrico Tassi has pointed out, that's significant tricky work.
It appears natural to me for the time being, to take the coqmod tool upstream to Dune, where it can be more quickly iterated and improved together with thing it is designed for. Later, we can bring the polished result downstream to Coq, and if needed factor coqdep through coqmod.
Regarding why I chose a separate binary instead of just a coqdep -modules mode. This way, we wouldn't have to care about versioning. coqmod would also work with older versions of Coq. In fact, the more I think about it, the more sense it makes to completely split coqmod from the Coq release cycle.
I can see why it appears natural you, but I also think that you don't have the full picture of the amount of work needed for this to happen, as you have just assumed that Dune is able to do Coq's loadpath resolution, but unfortunately, it is not, and the amount of code that is used in Coq to implement that is of the size of the full Coq Dune implementation.
So indeed, the strategy of keeping specific-knowledge about Coq's vernacular in Dune is a very risky one, as the moment Coq updates its vernacular Dune is S.O.L. Moreover, the work/benefit ratio of coqmod is as of today, very very high. That's a lot of work for very little benefit. There are, in my opinion, way more important things.
I think the right way to go about this, is for Coq to maintain the parts specific to Coq's vernacular as libraries, and for Dune to vendor them.
Moreover, this is also something doc managers and tools with more advanced package management such as jsCoq do need too. So your approach would imply a large duplication of logic and code that can't go very well for anybody involved.
Emilio Jesús Gallego Arias said:
Ali Caglayan said:
Let me be clear that
coqmod
will not know about -Q and -R, that is up to Dune to resolve (which it already does today).Ali Caglayan , how does Dune resolves deps today? It does not, and as Enrico Tassi has pointed out, that's significant tricky work.
Dune today, is able to map logical names to directories. It just needs to pass these as -Q parameters to coqc which will be doing the actual loading
All of this work, if done per file, is mostly wasted work. Enrico suggests calling coqdep only once, this is possible but it comes at a cost. It does not scale well. If you have a large amount of .v files, coqdep will have to lex each and everyone of them to work out all the dependencies. So if you change a source file, you will have to do the lexing step again and again for everything.
That reasoning is a bit strange, in the sense that yes, maybe the work done per file is wasted, but you are just moving where the work will be done. Putting this in Dune won't reduce the amount of work to be done at all, you will just indeed share the scanning of the FS.
Moreover, all this work takes a trivial amount of time. Lexing + resolution is on the microseconds with modern processors. So you are gaining a very little time in the build.
For me, separation is useful not for performance (which I'm willing to be is just a very marginal improvement, in the order of 200 microseconds per file) but in that it allows you to support more advanced features; like in jsCoq, we have a hack now to download libraries lazily from the web when a Require happens. A much more interesting use cases.
But for that we need coqmod and also more stuff for loadpath handling. In fact, it is even possible that once we implement the required infrastructure for Coq and Flèche, coqmod is just redundant, as things work in a say similar to what DAP could be.
Dune today, is able to map logical names to directories. It just needs to pass these as -Q parameters to coqc which will be doing the actual loading
Yes, that's trivial. What is not trivial (and Dune can't do yet) is to map From Foo Require A
to a file.
It makes sense to move this mapping to Dune indeed, but should happen by vendoring Coq's coq-core.loadpath
library.
So indeed, the strategy of keeping specific-knowledge about Coq's vernacular in Dune is a very risky one, as the moment Coq updates its vernacular Dune is S.O.L. Moreover, the work/benefit ratio of coqmod is as of today, very very high. That's a lot of work for very little benefit. There are, in my opinion, way more important things.
The benefit is this. We can develop coqmod in tandem with Dune, get it working well. Allow for some reassurance that coqdep and coqmod are doing the same thing, which allows us to move coqmod back into Coq and refactor coqdep. There are still implementation details needing to be sorted out on the Dune side.
Maybe I didn't stress this enough, but coqmod would not be replacing coqdep on the Dune side. Dune will still work with coqdep for the time being, I am just suggesting a way we can develop these tools further.
Ali Caglayan said:
So indeed, the strategy of keeping specific-knowledge about Coq's vernacular in Dune is a very risky one, as the moment Coq updates its vernacular Dune is S.O.L. Moreover, the work/benefit ratio of coqmod is as of today, very very high. That's a lot of work for very little benefit. There are, in my opinion, way more important things.
The benefit is this. We can develop coqmod in tandem with Dune, get it working well. Allow for some reassurance that coqdep and coqmod are doing the same thing, which allows us to move coqmod back into Coq and refactor coqdep. There are still implementation details needing to be sorted out on the Dune side.
Maybe I didn't stress this enough, but coqmod would not be replacing coqdep on the Dune side. Dune will still work with coqdep for the time being, I am just suggesting a way we can develop these tools further.
How is this a benefit? It seems more work to me
You can of course have a dev branch where you have coqmod vendored for quick development, you need to vendor loadpath.ml too
but in the end, you wanna this to live in the Coq repos, so when coq devs change the vernacular they update coqmod
To be clear, it is more work the moment you put that code in a released dune version
then you are S.O.L.
for developing of course you do the way is best for your own dev workflow
There is something I don't quite understand here. You say that loadpath resolution needs to be duplicated in Dune. Why? When I write From A Require B.
I imagine that Dune will be able to look for a coq.theory called A
perhaps a partial match like mathcomp
or a more specific one like Coq.Arithmetic
. Then it would have to search in the scope of that theory for a file called A. The rules for which are not that complicated, and Dune can already detect ambiguous paths.
If you don't duplicate it, how are you gonna map the From A Require B
to an actual file.
Complicated is indeed a subjective measure
indeed, in the grand scheme of Coq or Dune codebase they are certainly pretty trivial
but they have a lot of cases to handle
In Coq this is a lot of work because there is no (usable) existing infrastructure for crawling for dependencies. Dune already has such a thing.
due to overlaps and ambiguity, the code is the you can check it
Ali Caglayan said:
In Coq this is a lot of work because there is no (usable) existing infrastructure for crawling for dependencies. Dune already has such a thing.
What is exactly the part of current Coq codebase that is complex but Dune's API would replace?
In coqdep, there is code to crawl entire directories recursively, and check for duplicate/ambiguous files.
What is the Dune infrastructure you are referring too? I'm not aware of it
Yes, that code is duplicated in coqdep and coqc
but that code is very Coq specific, I'm not sure Dune has code to do this
first step is to get rid of the duplication
also coqdoc has this code a bit
crawling the directories is the easy part, the hard part is to build the map
well, not hard, but subtle
as there is a lot of cases to handle
would be great to actually reduce what's allowed
that can go in parallel with the rest of the work
but actually that's a good example of the dangers of duplicating logic
Coq developers may choose to fix some of the bad semantics of -Q
so actually less behaviors are allowed
now, that happens in Coq master, and now, unless you vendor that code, you have a lot of work to understand Coq's change, port it to Dune, and test it properly
and moreover, you have no real guarantees that code is doing the same
Emilio Jesús Gallego Arias said:
Coq developers may choose to fix some of the bad semantics of
-Q
Do you have a concrete example of this, or is it just a hyppothetical?
Paolo Giarrusso said:
If the above is correct, here are my actual 2 cents:
as a user, it seems safer if dune can keep using coqdep until coqmod stabilizes and is upstreamed, so that dune's coq support will not regress.
The problem is that dune cannot progress with improving support in many ways without coqmod.
Rudi Grinberg said:
Paolo Giarrusso said:
If the above is correct, here are my actual 2 cents:
as a user, it seems safer if dune can keep using coqdep until coqmod stabilizes and is upstreamed, so that dune's coq support will not regress.The problem is that dune cannot progress with improving support in many ways without coqmod.
Then add coqmod to Coq, and vendor it for previous versions, but you need to be careful indeed as the syntax of Coq has changed
Enrico Tassi said:
Thanks for the pointer. I think duplication of lexing code is minor compared to duplication of handling of -R and company. If coqmod does not resolve to files, then the logic must be duplicated in dune.
This is very worrying, the fact that rules for .v files are hardwired and not overrideable was a major pain when we changed the way cmxs are loaded: I wrote a crapload of compat code to unentangle the release of coq and dune.
I don't know why this was difficult, but did you look into the changing the coq rules in dune at all? If so, what was difficult about it?
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
Coq developers may choose to fix some of the bad semantics of
-Q
Do you have a concrete example of this, or is it just a hyppothetical?
I have a concrete example, like we just did forbidding certain kind of ambigous paths, and we'd like to forbid more.
There are several issues opened about it
Enrico Tassi said:
If the reason for developing coqmod is to speed things up, then the other path of calling coqdep once is way more reasonable to me.
That yields poor incremental performance. It's how it used to work for ocamldep but we changed it for this reason.
Rudi Grinberg said:
Enrico Tassi said:
Thanks for the pointer. I think duplication of lexing code is minor compared to duplication of handling of -R and company. If coqmod does not resolve to files, then the logic must be duplicated in dune.
This is very worrying, the fact that rules for .v files are hardwired and not overrideable was a major pain when we changed the way cmxs are loaded: I wrote a crapload of compat code to unentangle the release of coq and dune.I don't know why this was difficult, but did you look into the changing the coq rules in dune at all? If so, what was difficult about it?
Actually the amount of code to support the old loading model is very little. It is more that was hard to figure out how to do it.
The main difficulty we have to fix Dune rules is a) lack of manpower and will b) bugs in Dune such as https://github.com/ocaml/dune/issues/5833
Emilio Jesús Gallego Arias said:
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
Coq developers may choose to fix some of the bad semantics of
-Q
Do you have a concrete example of this, or is it just a hyppothetical?
I have a concrete example, like we just did forbidding certain kind of ambigous paths, and we'd like to forbid more.
I still don't understand, what more do you want to forbid?
Rudi Grinberg said:
Enrico Tassi said:
If the reason for developing coqmod is to speed things up, then the other path of calling coqdep once is way more reasonable to me.
That yields poor incremental performance. It's how it used to work for ocamldep but we changed it for this reason.
The proportional cost is very little in Coq, due to the different compilation ratio time.
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
Coq developers may choose to fix some of the bad semantics of
-Q
Do you have a concrete example of this, or is it just a hyppothetical?
I have a concrete example, like we just did forbidding certain kind of ambigous paths, and we'd like to forbid more.
I still don't understand, what more do you want to forbid?
See the issues opened, but for sure I want to to keep evolving the current semantics.
So yes, coqmod
is nice to have, but the actual benefit for the users will be minimal
Don't put a sad face, my time is limited Ali :(
There is just so much I can do
That reasoning is a bit strange, in the sense that yes, maybe the work done per file is wasted, but you are just moving where the work will be done. Putting this in Dune won't reduce the amount of work to be done at all, you will just indeed share the scanning of the FS.
Moreover, all this work takes a trivial amount of time. Lexing + resolution is on the microseconds with modern processors. So you are gaining a very little time in the build.
Every single change will require the batch job to re-read every single file in the theory. The amount of work is proportional to the amount of files in the theory. Every single file needs to be scanned before any actual useful compilation work is started.
So I will indeed just summarize: duplication of Coq-specific logic makes little sense and will create a large maintenance pain. We should have a single source of truth w.r.t. how Coq loading semantics work, and have tools vendor it.
Rudi Grinberg said:
That reasoning is a bit strange, in the sense that yes, maybe the work done per file is wasted, but you are just moving where the work will be done. Putting this in Dune won't reduce the amount of work to be done at all, you will just indeed share the scanning of the FS.
Moreover, all this work takes a trivial amount of time. Lexing + resolution is on the microseconds with modern processors. So you are gaining a very little time in the build.
Every single change will require the batch job to re-read every single file in the theory. The amount of work is proportional to the amount of files in the theory. Every single file needs to be scanned before any actual useful compilation work is started.
Yes, this takes _microseconds_
In OCaml you feel it more, as compilation is much faster
so that's a nice thing to have, just users won't see a lot of benefit
cutting couple of seconds of a 30 mins build
Already the time I spent writing here, I would have ported coqdep to use the new lexer
because, if the new lexer is not good for coqdep, there is no way is good for anything else
as it has to be buggy then
Yes, of course it's meaningless for a clean build. It is however quite useful for tiny changes that you'd expect instant feedback for. I highly doubt it's going to be microseconds in the first place, but even if it is, it's microseconds before dune will start the coqc
jobs. So the delay is microseconds * the number of cores.
There are virtually no cases when you can get instant feedback from .v -> .vo
compilation
just the loading of deps makes coqdep take several seconds
due to marshall
Emilio Jesús Gallego Arias said:
There are virtually no cases when you can get instant feedback from
.v -> .vo
compilation
There are with the cache :)
Emilio Jesús Gallego Arias said:
Don't put a sad face, my time is limited Ali :(
This is not a sad face but a confused one. I still don't get what you want to change about -Q.
now you are talking about a document server, but that's beyond what dune can do today, for intra-file changes
Emilio Jesús Gallego Arias said:
now you are talking about a document server, but that's beyond what dune can do today, for intra-file changes
Who is talking about a document server?!
Emilio Jesús Gallego Arias said:
because, if the new lexer is not good for coqdep, there is no way is good for anything else
I suppose we both are concerned about this, but are addressing it differently:
Rudi Grinberg said:
Emilio Jesús Gallego Arias said:
There are virtually no cases when you can get instant feedback from
.v -> .vo
compilationThere are with the cache :)
Ok, but even so, people rarely use this workflow in Coq, they never call coqc on files they are working on, they use interfactive mode.
so actually vendoring loadpath makes even more sense, because you need Coq support to improve the common interactive workflow
and in this case you don't even need coqmod
Coq can callback on Dune when Require
is found
Anyways I like coqdep
coqmod sorry
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
Don't put a sad face, my time is limited Ali :(
This is not a sad face but a confused one. I still don't get what you want to change about -Q.
Specifically, we are not asking you to implement any changes in Coq, but why you are against this one in the first place?
So we went from re-implementing coqdep on top of coqmod to throwing coqmod away? :thinking:
and while it is not gonna make a large impact compared to other features, of course I'd be amazing to have it and many people would be very happy with this improvement
nobody is questioning that
what I'm questioning is that having 2 lexers is a very bad idea
Is it not just a temporary state though?
Emilio Jesús Gallego Arias said:
what I'm questioning is that having 2 lexers is a very bad idea
Give me some time, let me write a reply to this.
Temporary is fine, but porting takes a few mins
actually I didn't port it myself as then I can't merge the PR
and in fact, the CI would be a good test for the new lexer
Emilio Jesús Gallego Arias said:
Temporary is fine, but porting takes a few mins
Please don't do this!
Why do you care?
You will be forcing possibly buggy code on the rest of the Coq users
that's touching coqdep, not coqmod
then if the code is buggy, it should be fixed ASAP right?
why you want to work with buggy code then?
Then you'll have to debug Coq universe, that won't be fun
No code in production starts of bug free. It goes through cycles of testing and then deployment.
Yes, that's why we have a CI
and 2.5k bugs open
The CI has ok coverage but it won't cover every case.
it won't eys
it won't yes
So why needlessly put users through this?
but that's our current method to determine "it works"
If we can factor coqdep in the future through coqmod once it has been tested further?
Ali Caglayan said:
So why needlessly put users through this?
I thought the idea was for users to use coqmod in the end?
Well, a good way to start testing is to use the lexer in Coq's CI
Right, but I need to turn an experiment into a solution in the meantime.
Right, and how do you plan to test it then?
You know, even if you implement coqdep on top of coqmod (Something that I think is a good idea - at least eventually), it would still be far simpler to iterate with coqmod + dune if coqmod is vendored in dune.
Rudi Grinberg said:
You know, even if you implement coqdep on top of coqmod (Something that I think is a good idea - at least eventually), it would still be far simpler to iterate with coqmod + dune if coqmod is vendored in dune.
The lexer of .v files is all you care
I don't see what you gain of forking that in Dune
the grammar itself I mean
We are not forking any grammar?
The lexer is only 200 lines
Yes, as I said porting coqdep to use the new lexer would have taken 5 mins
and if you have bugs, you can start fixing them
Emilio Jesús Gallego Arias said:
I don't see what you gain of forking that in Dune
Well it's a tiny component that allows us to unlock some deeper changes in dune. Once we're satisfied with the results on the dune side, we can know for sure that coqmod is good enough to be upstreamed.
and it is great you wrote a new lexer, the old one was very very old and needed a modern rewrite, so I'm looking forward to replace the old lexer
Rudi Grinberg said:
Emilio Jesús Gallego Arias said:
I don't see what you gain of forking that in Dune
Well it's a tiny component that allows us to unlock some deeper changes in dune. Once we're satisfied with the results on the dune side, we can know for sure that coqmod is good enough to be upstreamed.
The criteria for coqmod's lexer to be upstreamed is to work with Coq's CI
that's the main criteria
so seems wise to start with that step
Right, but this is future work. Which doesn't make sense to do at the moment.
and be sure you have a lexer that works
because otherwise you are gonna find youself debugging very weird build errors
And if you don't want experimental tools in Coq, fine.
We can develop in dune and usptream later.
Not in released code in Dune either
so of course I'm talking about released code
At no point did I say I would replace Dune's coq support with coqmod?
It is an experiment that we would like to conduct.
I don't know, I was not talking about Dune, but about https://github.com/coq/coq/pull/16153
and what needs for it to be merged
Right, I will close that and develop coqmod in Dune.
Will you put coqmod in Dune's main branch?
So that in the future I am happy for it to be factored with coqdep
So you are gonna do your own ad-hoc testing instead of profiting from Coq's infrastructure?
Seems like a bad plan to me
How are you gonna determine you are happy with the lexer?
Because as of today, the only way we have to measure "the lexer works" is Coq's CI
IIANM
Emilio you've said before the lexer is a trivial amount of work. Why are we dwelling on it? Let's do it once the whole feature is ready. Why block a massive chunk of work on some tiny change that will not impact anyone in the short/medium term? Even if the lexer is bad, we'll have 1000 opportunities to fix it before releasing anything.
Porting coqdep to the new lexer is a trivial amount of work
The whole lexer thing is a distraction, we should have just used coqdep's lexer to avoid this whole issue.
and gives you very valuable testing
so what's the argument against it?
Rudi Grinberg said:
The whole lexer thing is a distraction, we should have just used coqdep's lexer to avoid this whole issue.
Yes I agree, tho the new lexer is very nice
Don't fix what's not broken?
So I'd love to see it upstreamed
Rudi Grinberg said:
Emilio you've said before the lexer is a trivial amount of work. Why are we dwelling on it? Let's do it once the whole feature is ready. Why block a massive chunk of work on some tiny change that will not impact anyone in the short/medium term? Even if the lexer is bad, we'll have 1000 opportunities to fix it before releasing anything.
I'm dwelling on it because there is this PR I want to get merged!
If we put this in Coq, factored through coqdep today, it will be impossible to make any changes for Dune.
Ali Caglayan said:
Don't fix what's not broken?
Well the old lexer seems to be broken , for example it didn't report positions etc... it was not exactly broken, but needing a rewrite, and I like a lot the new one
Ali Caglayan said:
If we put this in Coq, factored through coqdep today, it will be impossible to make any changes for Dune.
Put just the new lexer if you want
that's OK for me
but actually coqmod has nothing else
than the lexer
why would you need to change the lexer for Dune?
you may have, but you can submit a PR to Coq
This is slow
Well, then keep your copy, fine
but that copy can't be exposed to users
Emilio Jesús Gallego Arias said:
so what's the argument against it?
I'm not arguing against it. I just have no opportunity to compel anyone to work on what I want. When I fail to do so, I just try to make progress from another angle :)
Emilio Jesús Gallego Arias said:
but that copy can't be exposed to users
The only reason being is that you wanted to factor through coqdep when it wasn't ready.
The thing is, a new lexer was written. I like it a lot. However, if that lexer is gonna be used by final users, I don't care if in Dune or Coq, it has to be properly tested.
Ali Caglayan said:
Emilio Jesús Gallego Arias said:
but that copy can't be exposed to users
The only reason being is that you wanted to factor through coqdep when it wasn't ready.
Well, everything looked ready to me in the PR, except for getting rid of the old lexer
Let's get rid of it in a future PR
That way we can test it there too.
How about we just leave the PR open for now until we have something working in dune? What's the rush to merge it?
Ali Caglayan said:
Let's get rid of it in a future PR
I'm afraid I can't support having two lexers in the codebase, even if that's temporary.
Rudi Grinberg said:
How about we just leave the PR open for now until we have something working in dune? What's the rush to merge it?
Not a rush, but I bet is ready.
I think indeed it is very important to test the lexer before you make progerss on the Dune side, makes little sense to me that you start using in Dune a new untested lexer that could create you a lot of unrealted trouble.
As of today, coqmod is potentially only useful as an implementation detail of dune's rules.
@Rudi Grinberg if we listen to what Ali is suggesting, coqmod could give you wrong dep analysis too
Coqmod does no dep analysis!
It just reports tokens that introduce deps
Emilio Jesús Gallego Arias said:
Rudi Grinberg said:
How about we just leave the PR open for now until we have something working in dune? What's the rush to merge it?
Not a rush, but I bet is ready.
I think indeed it is very important to test the lexer before you make progerss on the Dune side, makes little sense to me that you start using in Dune a new untested lexer that could create you a lot of unrealted trouble.
It will not cause us trouble because it will take us a while to modify things enough to even use it correctly. Once we get to the point where we can actually run things, we'll consider these questions.
how is that different from dep analysis?
Rudi Grinberg said:
Emilio Jesús Gallego Arias said:
Rudi Grinberg said:
How about we just leave the PR open for now until we have something working in dune? What's the rush to merge it?
Not a rush, but I bet is ready.
I think indeed it is very important to test the lexer before you make progerss on the Dune side, makes little sense to me that you start using in Dune a new untested lexer that could create you a lot of unrealted trouble.
It will not cause us trouble because it will take us a while to modify things enough to even use it correctly. Once we get to the point where we can actually run things, we'll consider these questions.
Indeed, and that's the second problem, to do so, you will have to duplicate a logic that is already inconsistent in Coq's own codebase, introducing a 4th version of the resolution rules.
So we all would be better off with continuing the work on coq-core.loadpath
and having Dune vendor it.
I am positive we will change resolution rules, for (using coq 2.0)
for example
so we want an easy way to keep coqc
and dune in sync
so it is very easy, we are just making things complex
Tho I insist again that I'm talking about the point things get upstreamed to Coq or Dune
of course you can experiment a lot
Emilio Jesús Gallego Arias said:
Ali Caglayan said:
Let's get rid of it in a future PR
I'm afraid I can't support having two lexers in the codebase, even if that's temporary.
I very agree
but again Ali you didn't answer to what is the concrete problem in having Coq's CI using coqmod's new lexer
it takes you 5 minutes
and you get a lot of feedback on your lexer
if it works, we can push it
if it doesn't, you already know you have problem
you may choose to ignore it
but you know that when using your Dune coqmod branch in Coq Universe
you'll be in problems
@Emilio Jesús Gallego Arias you seem to be claiming there are no downsides in the slower development cycle, and that's too strong —
all the downsides you point out are real, of course
@Paolo Giarrusso , more concretely, I claim that in the list of TODOs I have in Dune, cutting two seconds of a build seems low to me
for example, it is much more prioritary to have better doc build, and to allow people to do opam packages with Dune
and make dune-release work
I also agree that incremental lexing is a distraction
coqmod is great
the discussion gets sidetracked all the time
because as a Coq dev I'm only interested in upstreaming a new lexer
Emilio Jesús Gallego Arias said:
So we all would be better off with continuing the work on
coq-core.loadpath
and having Dune vendor it.
I disagree that "our" efforts are better off spent working on one whatever you think is the highest priority. That is not how progress is made in the open source world. It's in fact how contributors get discouraged and abandon projects.
which is a great thing as we really needed to replace the old one
Rudi Grinberg said:
Emilio Jesús Gallego Arias said:
So we all would be better off with continuing the work on
coq-core.loadpath
and having Dune vendor it.I disagree that "our" efforts are better off spent working on one whatever you think is the highest priority. That is not how progress is made in the open source world. It's in fact how contributors get discouraged and abandon projects.
Fair point, tho my thinking is backed by my quantitative / qualitative analysis
@Emilio Jesús Gallego Arias nobody has conclusive quantitative analysis of software development costs :-)
So I'm open to reconsider my plan, but I'm asking about the advantages of the alterantive plan, what are they?
In the open source world, we many times do plans that go really bad!
My analysis is not conclusive, it is just my analysis, which I'm willing to reconsider
note how many questions I've asked and quite a few got no answer
Paolo Giarrusso said:
Emilio Jesús Gallego Arias nobody has conclusive quantitative analysis of software development costs :-)
I've indeed updated my sentenced to highlight that this is, of course, my analysis!
In Coq for example, someone thought that having 3 different implementations of loadpath resolution was a good idea
blocking a massive branch of work on "5 minutes of work" does not sound quantitatively sound to me. I'm sympathetic to the correctness concerns, but honestly it's not enough to spook me off. There's a dozen of other issues that we'll be able to solve once we have coqmod in dune that are completely unrelated and will benefit everyone no matter what lexer is used.
Rudi Grinberg said:
blocking a massive branch of work on "5 minutes of work" does not sound quantitatively sound to me. I'm sympathetic to the correctness concerns, but honestly it's not enough to spook me off. There's a dozen of other issues that we'll be able to solve once we have coqmod in dune that are completely unrelated and will benefit everyone no matter what lexer is used.
how's the branch blocked @Rudi Grinberg ?
who's blocking anything? (and how?)
@Emilio Jesús Gallego Arias the point is that there are _sometimes_ advantages to starting over and prototyping from scratch
Of course @Paolo Giarrusso , I do all the time myself, just go and see my projects on github
I have reimplemented quite a few components from scratch just for Coq
good we agree here
Emilio Jesús Gallego Arias said:
In Coq for example, someone thought that having 3 different implementations of loadpath resolution was a good idea
coqc/coqdep/??? what's the 3rd?
Nor do I suggest forking anything. I'd be interested in fixing the loadpath issues as well if I understood them better. I'm just mentally prepared to work on the coqmod stuff already and have a good idea of how to go about it. Once I get to that state with loadpath, I'd be interested in adapting dune to use that.
hope we also agree that the prototypes will not be feature-complete/pass 100% tests/etc etc early on
Gaëtan Gilbert said:
Emilio Jesús Gallego Arias said:
In Coq for example, someone thought that having 3 different implementations of loadpath resolution was a good idea
coqc/coqdep/??? what's the 3rd?
coqchk and coqdoc :S
haha so I forgot how to count
let's get rid of that stuff Gaëtan
Well coqchk and coqdoc make half each, so it is 1 + 1 + 0.5 + 0.5 = 3
I can't really imagine why you'd need much prototyping in _the lexer_ (or parser, I'd say), but I can imagine the _API_ might need iteration; much more likely, the loadpath API might need iteration
So what do you want to do Emilio? I guess I can hack coqdep to use the new lexer, would that be sufficient?
Emilio Jesús Gallego Arias said:
who's blocking anything? (and how?)
Great, so how about this: let's get coqmod working in dune. Put it behind an experimental flag. Then re-asses once we determine if it's actually a useful thing.
coqchk and coqdoc at least get to work with only absolute paths (not sure about coqdoc)
@Paolo Giarrusso it needs a lot of iteration, but actually you need to update Coq itself. So for jsCoq I can afford to fork Coq, but for example, for SerAPI I need to push upstream. That's indeed very slow and frustrating :(
Ali Caglayan said:
So what do you want to do Emilio? I guess I can hack coqdep to use the new lexer, would that be sufficient?
Sufficient for what?
we seem to all agree that eventually, you need to update Coq, but for the prototype you might not want to.
Gaëtan Gilbert said:
coqchk and coqdoc at least get to work with only absolute paths (not sure about coqdoc)
That's why I counted them like less than one , so indeed maybe we can write them off, but there is at least the command line parsing logic etc...
also coqlib detection
Emilio Jesús Gallego Arias said:
Gaëtan Gilbert said:
Emilio Jesús Gallego Arias said:
In Coq for example, someone thought that having 3 different implementations of loadpath resolution was a good idea
coqc/coqdep/??? what's the 3rd?
coqchk and coqdoc :S
Perhaps what is missing here is a standard rather than a single implementation. The fact that there's 3 different wrappers around walking the file system is not what's scaring me. It's that nobody knows when is one of them is incorrect.
Rudi Grinberg said:
Emilio Jesús Gallego Arias said:
who's blocking anything? (and how?)
Great, so how about this: let's get coqmod working in dune. Put it behind an experimental flag. Then re-asses once we determine if it's actually a useful thing.
Sure that sound good, and it is for sure useful.
okay, that sounds like progress SwEng side!
Emilio Jesús Gallego Arias said:
Ali Caglayan said:
So what do you want to do Emilio? I guess I can hack coqdep to use the new lexer, would that be sufficient?
Sufficient for what?
Ping @Ali Caglayan (gonna head to cook lunch in a minute)
I meant for making progress, but it looks like we agree on "vendoring" in Dune now?
upstreaming is a strong work. just getting it working in the simplest way possible is the goal.
then we argue about what lives where
@Ali Caglayan what does upstreaming to Dune mean?
I can keep the PR open, and when we deem coqmod ready for general use, we can add it to the Coq repo with the coqdep changes too.
(I bet there are more)
By the way, I've moved the discussion into two disucssions
This is now about coqmod
The other is about loadpath resolution
Ali Caglayan said:
I can keep the PR open, and when we deem coqmod ready for general use, we can add it to the Coq repo with the coqdep changes too.
That sounds good, at your will, I think the PR is ready to merge tho, I'd be surprised the lexer is buggy (and if it is buggy IMHO you want to learng about it sooner than later)
@Emilio Jesús Gallego Arias did you make sure that coqmod doesn't introduce any loadpath related inconsistencies? at least from the test suite?
But before I go let's make sure we are on the same page on what "upstreaming to Dune" means
We add coqmod into dune, it doesn't need any code from the Coq library anyway.
Emilio Jesús Gallego Arias said:
But before I go let's make sure we are on the same page on what "upstreaming to Dune" means
Ok, that sounds good, tho I still don't understand why you want to do the first item
Because package managers suck. Opam especially so
What I would do is to put coqmod in Coq and then vendor it
but it is up to you
Tbh, it would have allowed us to move even faster if we did it this way from the start. All that discussion about serialization could have been avoided completely.
or at least the lexer part
Rudi Grinberg said:
Tbh, it would have allowed us to move even faster if we did it this way from the start. All that discussion about serialization could have been avoided completely.
that would depend on how buggy the new lexer is. If the lexer is buggy, I bet you save time by testing it in Coq's CI first
Emilio Jesús Gallego Arias said:
or at least the lexer part
@Ali Caglayan If you can work on upstreaming the lexer in coqdep, that would be nice.
anyways I think the point is clear
Emilio Jesús Gallego Arias said:
Rudi Grinberg said:
Tbh, it would have allowed us to move even faster if we did it this way from the start. All that discussion about serialization could have been avoided completely.
that would depend on how buggy the new lexer is. If the lexer is buggy, I bet you save time by testing it in Coq's CI first
I agree. Once we're at the point where testing can even be considered, let's think about verifying correctness ASAP.
You can test now if you want
That was my whole point
Right, but we don't have the Dune side implementation yet :))
That needs to be done first.
I meant the lexer
Indeed we would have saved more than 1h discussion if we had just pushed the 5 mins change
I don't think it is 5min work as you claim, but I can submit a commit showing coqdep factored thru
coqmod relies on csexp as a private lib
so I can't make a coqmod lib
I need to pull all the csexp stuff away
thats more than 5 min work unfortunately.
But I guess mostly my fault for intertwining it this way.
I offered to do that too
you just need to pull the lexer
then you flatten, and iterate
@Emilio Jesús Gallego Arias Do you want to do it?
As you prefer!
If that's boring for you I can push
I did port it, see PR
however there are many parsing problems I'm afraid
Can't even parse most of Coq's stdlib
Seems to require significant work
Last updated: Oct 13 2024 at 01:02 UTC