-
Notifications
You must be signed in to change notification settings - Fork 679
Scoped options #313
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
Scoped options #313
Conversation
Before this patch, Set and Local Set behaved the same outside of a section, i.e. they disappeared at module closing. Now, setting an option without a qualifier allows to activate it whenever the module it lives in is imported. This is a much saner behaviour that allows to scope options properly. Fixing the Coq source files was a mere matter of systematically replacing every Set / Unset invokations by a corresponding Local Set / Unset command.
What does If so, why choose that path rather than limit |
I would prefer if the semantics of |
If I had to redo everything, without any backward compatibility constraints I would do the following: But we have to live with what we have. |
I think that Global options acting at require time are an antipattern, but they have their reasonable uses for smelly hacks. So it should be discouraged to use them (e.g. issuing a warning) but the feature has to exist nevertheless. |
I think there is one legitimate use case for side effects of require, and one use case that currently has no good alternative:
|
Your first use case is appealing, but I fail to see why you couldn't use some project-local file that you import everywhere in the second case. It sounds as a rather good practice to me, as this is a widespread pattern in many languages. |
It cannot be merged as is anyway, due to the unwarranted changes to That being said, I don't think we reached a conclusion either. In particular, I think that there was a consensus that it is the semantics of |
My feeling is that we all had in mind a semantics close to the one @aspiwack described in his second message above. The problem is how to get there, and what to do w.r.t. compatibility. Your point about adding a new vernacular rather than changing the current semantics may be the way to go. What was less clear, was whether we really want to keep support for some options that have effect on |
I think I will bitterly regret this suggestion in a few years, but what about |
@silene I prefer this PR to be closed rather than introducing yet another syntax that we will have to support for ages, as well as a discrepancy in the semantics of local modifiers. One of the goal of the PR was to bring the semantics of various Local / Nothing modifier closer. @maximedenes I don't actively advocate for Global having an effect at Require time, I just witnessed that some people relied on that in a way that was very hard to provide otherwise. So I think its use should be discouraged but the feature shouldn't be removed either. The point of this PR is that it separates two behaviours that are merged as of today. It does not change the semantics of Local Set. |
@ppedrot Are you ok with postponing this until we make up a clear plan for the scoping of options? |
Fine, but I'm a bit concerned by the fact we're promoting a worse solution as a currently working alternative (i.e. Require-time effects). |
There seems to be many tricky situations wrt As the discussion we had yesterday in Gitter, there are many many surprising things wrt to preservation of effects, so maybe a wider cleanup is required. |
We desperately need something like this for Iris. When developing a library, it is sometimes necessary or at least useful to set some Coq option to something other than the default. However, one wants to do that without forcibly inflicting this non-default choice on all of ones dependencies. Currently, this is pretty much impossible to do in a convenient way: What you can do, of course, is copy-paste all the options you are interested in into every single file. That's obviously a bad idea. So, instead we want some file, say
If I understand this PR correctly, it would fix this situation. So, please, having something like this for 8.8 would be much appreciated :) |
We should make sure that this PR gets discussed at the next WG. I'm going to add it to the wiki page. |
I'm afraid Scope handling is one of the most delicate issues in the current system. Quoting @silene who IMHO is spot on:
thus we are talking here about the future of the module code and of libobject and thus of sections #6254 Not an easy topic. |
@Zimmi48 This PR is a seasnake, we already discussed it like twice, in a WG and at the implementors' workshop. I'm not sure discussing it again would make any progress, except if I take hostages. |
Indeed we don't need to discuss this PR but discuss the whole story about scoping in Coq. Personally, I don't agree with this change as I'd rather fix the scoping mess at once and have the users suffer pain only once. |
If this PR is still controversial, would it be OK to close it and to propose a more specific solution to the clearly expressed and legitimate user need of @RalfJung? We may even start by creating an issue for this. |
IMVHO closing the PR is not the right thing to do, I feel that some chat in person with the people involved on this is the way to go for now. |
But something must happen. You discourage me from putting this PR as needing discussion at the WG but in the same time you need some IRL discussion is needed, and there is no planned talk at the WG about the scoping of options... |
I am with Pierre-Marie here in the sense that discussion in the WG is not gonna get anywhere. This needs development discussion, with a laptop and a few people looking into the code, etc... |
What would you think of having developer sessions at the WG, in the sense of small groups of people working on a topic? We could announce the topics, people would sign up so that we balance the size of groups,etc. |
This is badly needed IMO, that is to say, a Coq "Hackaton", where code is written, as opposed to the "plenary" WG, where all developers are present. We could however make Coq Hackatons fully independent of the WG; maybe we could try hosting one at IRIF? @herbelin @mattam82 ? Are you familiar with similar events in the Haskell community ? |
What about the carbon footprint? ;-) I would rather make the WG longer rather than create more events that would require people to travel even more. |
IMHO these are separate events, attracting different kind of people; of course nothing is preventing us from placing them in a temporally contiguous time-frame. |
But I will organize a Coq Hackaton some day for sure, independent from the WG. It will be in Paris [obviously as I'm based here], and people is not required to travel, indeed, it will be more of an event for newcomers to the Coq world. |
I would be really glad to see some Coq hackaton happening online. I don't think it would help in the present issue where some careful design is needed but it would have lots of other benefits. Did you see that Atom now allowing to have collaborative coding sessions? (I think we are disgressing) maybe this should become an independent discussion. |
This has "Milestone: 8.8", what is the status? We'd still like to experiment more with Coq options in our libraries, but really can't because that would inadvertently also affect all our users. |
I'd like to discuss this again during the WG. I'll try to prepare the discussion. |
Discussion didn't converge a lot. Everyone agrees that we want this in, however there are some semantics / uniformity issues. It is very likely that any change in this direction will break many 3rd party developments, it would be thus convenient to have a clear roadmap about uniform behavior on A wiki page recollecting the existing semantics has been started at: Meanwhile, a non-optimal workaround to avoid boilerplate in large projects is to use |
How realistic is it to fix this short-term? Sounds like the perfect being the enemy of the good.
If the command that performs "
IIRC, I tried this and it doesn't work well for libraries -- the Also, we were warned by @ppedrot that |
I am sorry but we have to be careful here. We are talking of forcing every project to add non-backwards compatible modifications. So we cannot get it wrong.
I see a few problems there but none of them are related to
It was broken for a while but the status in Note that using |
The modification is backwards-compatible in the sense that the projects would continue to work with old versions of Coq. However, I agree that's still not nice. From what I gathered, there was the proposal to instead use new syntax to have "
Does it support giving a qualified path? |
Load needs a relate file path, as in |
The |
This feature has been asked many times by different people, and allows to have options in a module that are performed when this module is imported. This supersedes the well-numbered cursed PR rocq-prover#313.
Closing this PR as it has been superseded by #6923. |
This feature has been asked many times by different people, and allows to have options in a module that are performed when this module is imported. This supersedes the well-numbered cursed PR rocq-prover#313.
This feature has been asked many times by different people, and allows to have options in a module that are performed when this module is imported. This supersedes the well-numbered cursed PR rocq-prover#313.
313: Upstream recent improvements r=beta-ziliani a=Janno Companion MR to Mtac2/Mtac2#311 targetting master. Only one commit is not included because it already exists in master: ``` commit e0663f619a61cb5942b462e9e42cb145a9edbeff Author: Jan-Oliver Kaiser <[email protected]> Date: Fri Aug 21 15:36:51 2020 +0200 Remove workaround for monomorphic evars in patterns. ``` @beta-ziliani I noticed while porting these commits that some bug fixes in master have not been backported to 8.12. We should probably fix that. **TODO**: - [x] Changelog entries (can mostly be copied from 8.12 when they are done) Co-authored-by: Jan-Oliver Kaiser <[email protected]> Co-authored-by: Jan-Oliver Kaiser <[email protected]> Co-authored-by: beta <[email protected]>
Before this patch, Set and Local Set behaved the same outside of a section,
i.e. they disappeared at module closing. Now, setting an option without a
qualifier allows to activate it whenever the module it lives in is imported.
This is a much saner behaviour that allows to scope options properly.
Fixing the Coq source files was a mere matter of systematically replacing
every Set / Unset invokations by a corresponding Local Set / Unset command.