Skip to content

Export options#6923

Merged
maximedenes merged 4 commits intorocq-prover:masterfrom
ppedrot:export-options
Mar 9, 2018
Merged

Export options#6923
maximedenes merged 4 commits intorocq-prover:masterfrom
ppedrot:export-options

Conversation

@ppedrot
Copy link
Copy Markdown
Member

@ppedrot ppedrot commented Mar 6, 2018

This PR implements the Export Set/Unset feature as discussed in the last WG.

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 #313.

I did not document it in the refman yet, as I don't know what's the protocol regarding the sphinx port of the documentation. What is recommended?

@ppedrot ppedrot added needs: review kind: feature New user-facing feature request or implementation. labels Mar 6, 2018
@ppedrot ppedrot added this to the 8.8+beta1 milestone Mar 6, 2018
@ejgallego
Copy link
Copy Markdown
Contributor

I think this looks good @ppedrot , however I wonder what level of "promise" should be made on this extension. IMVHO it is still not clear what the story with scoping may be, so we may want to label this option as "Use at your own risk".

Maybe the "Coq 9" project would be a good moment to unify the handling of scoped semantics.

@maximedenes
Copy link
Copy Markdown
Member

I did not document it in the refman yet, as I don't know what's the protocol regarding the sphinx port of the documentation. What is recommended?

My plan is to integrate the infrastructure PR ASAP. Then, chapters will be merged one by one and removed from the manual. So it is probably best to wait. What chapter would this doc go in?

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented Mar 6, 2018

@ejgallego I don't know if this should be flagged as experimental. I definitely dislike the syntax inflation that is used to work around the scoping mess, but I'm fundamentally convinced this is the correct semantics for module-bound options. If anything, the syntax should be marked experimental, not what it does.

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented Mar 6, 2018

@maximedenes I guess in the description of variants of Set and Unset, in Chapter 6: Vernacular commands.

@ejgallego
Copy link
Copy Markdown
Contributor

Yup I suggest we add a small warning so at least users are aware syntax [and maybe semantics even if I agree with you] may be still in flux, so those wanting to write "super-stable" Coq can avoid this.

@maximedenes
Copy link
Copy Markdown
Member

so those wanting to write "super-stable" Coq can avoid this.

What should the warning recommend them to use instead, if they want to be stable?

@ejgallego
Copy link
Copy Markdown
Contributor

What should the warning recommend them to use instead, if they want to be stable?

You just don't use it. I mean a sentence in the documentation by the way, not an actual warning in the code.

@maximedenes
Copy link
Copy Markdown
Member

You just don't use it.

If you mean use Set without the Export modifier, isn't it going to make them write code that is going to break semantically (more painful) when we do the cleanup? I'm not convinced it would be a good recommendation.

@ejgallego
Copy link
Copy Markdown
Contributor

If you mean use Set without the Export modifier, isn't it going to make them write code that is going to break semantically (more painful) when we do the cleanup? I'm not convinced it would be a good recommendation.

I'm afraid I cannot follow. When we do the cleanup many things will break almost for sure, but if you keep the status-quo nothing should become worse.

@maximedenes
Copy link
Copy Markdown
Member

I'm afraid I cannot follow. When we do the cleanup many things will break almost for sure, but if you keep the status-quo nothing should become worse.

What I'm trying to say is that using the Export modifier is probably going to make things better in terms of stability for most users. Indeed, after the cleanup, we may want to remove that specific syntax at some point, but at least the semantics should stay in some form. So I'm afraid that telling users who want stable code not to use this feature is counter productive for them.

@ejgallego
Copy link
Copy Markdown
Contributor

Hard to say, we will see. It will be quite confusing as for example Export is not supported on many other things such as Coercions etc... in fact, as of today it is a quite rushed hack.

So I'm fine with rushed hacks as long as they are documented as such.

@Zimmi48
Copy link
Copy Markdown
Member

Zimmi48 commented Mar 6, 2018

If we are pretty confident that the semantics is the right one, then we can use this new syntax to unify the rest around this. And thus, keep the new syntax (and probably completely deprecate Global).

@ppedrot ppedrot mentioned this pull request Mar 6, 2018
@maximedenes
Copy link
Copy Markdown
Member

@ppedrot can you assign a reviewer?

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented Mar 7, 2018

I'm not quite sure about the proper person to review that patch. Any volunteers?

@vbgl vbgl self-requested a review March 7, 2018 12:39
Comment thread library/goptions.mli Outdated
@@ -150,11 +152,11 @@ val get_ref_table :

(** The first argument is a locality flag.
[Some true] = "Local", [Some false]="Global". *)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is outdated and should be fixed.

Comment thread vernac/vernacentries.ml Outdated
| VernacSetAppendOption (key,v) -> vernac_set_append_option ~atts key v
| VernacUnsetOption key -> vernac_unset_option ~atts key
| VernacSetOption (export, key,v) -> vernac_set_option ~atts export key v
| VernacSetAppendOption (key,v) -> vernac_set_append_option ~atts false key v
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dead code. The constructor VernacSetAppendOption should be removed from the vernac_expr data type.

Comment thread library/goptions.mli
val set_string_option_value_gen : bool option -> option_name -> string -> unit
val set_string_option_append_value_gen : bool option -> option_name -> string -> unit
val unset_option_value_gen : bool option -> option_name -> unit
val set_int_option_value_gen : ?locality:option_locality -> option_name -> int option -> unit
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keep it as a required argument?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, there is a default value in the type, so it's just a matter of taste.

@maximedenes
Copy link
Copy Markdown
Member

@ppedrot ping

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented Mar 8, 2018

@maximedenes Changes addressed.

@maximedenes
Copy link
Copy Markdown
Member

@vbgl do you approve now?

Copy link
Copy Markdown
Contributor

@vbgl vbgl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not test, but the diff looks good.

@vbgl vbgl added needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. and removed needs: review labels Mar 9, 2018
@maximedenes maximedenes removed the needs: rebase Should be rebased on the latest master to solve conflicts or have a newer CI run. label Mar 9, 2018
@maximedenes
Copy link
Copy Markdown
Member

@ppedrot Doesn't this break equations and ltac2?

@maximedenes
Copy link
Copy Markdown
Member

@RalfJung @ppedrot this is going to miss 8.8 just because it doesn't have overlays. If you don't want that to happen, please push them ASAP (I'm wrapping up all integrations this afternoon, and CI takes a long time to run).

@RalfJung
Copy link
Copy Markdown
Contributor

RalfJung commented Mar 9, 2018

What's an overlay...?

@maximedenes
Copy link
Copy Markdown
Member

What's an overlay...?

This PR breaks ltac2 and equations, and no fixes where pushed there AFAICT. An overlay is what makes CI picks up those fixes when testing external devs.

@ppedrot
Copy link
Copy Markdown
Member Author

ppedrot commented Mar 9, 2018

I'm on it.

ppedrot added 3 commits March 9, 2018 10:17
This prevents relying on an underspecified bool option argument.
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.
@Zimmi48
Copy link
Copy Markdown
Member

Zimmi48 commented Mar 9, 2018

@RalfJung FYI you should read https://github.com/coq/coq/blob/master/dev/ci/README.md#information-for-developers (even if partially outdated) and check this https://github.com/coq/coq/tree/master/dev/ci/user-overlays (linked from the previous file. BTW the first file was linked from the contributing guide but I suppose you have already read this one.

@maximedenes
Copy link
Copy Markdown
Member

@maximedenes
Copy link
Copy Markdown
Member

maximedenes commented Mar 9, 2018

@ppedrot you forgot to open PRs...

@maximedenes
Copy link
Copy Markdown
Member

I did it for you...

@maximedenes maximedenes merged commit a8297dd into rocq-prover:master Mar 9, 2018
maximedenes added a commit that referenced this pull request Mar 9, 2018
@Zimmi48
Copy link
Copy Markdown
Member

Zimmi48 commented Mar 9, 2018

An issue should be open not to forget to document this before 8.8.0.

@RalfJung
Copy link
Copy Markdown
Contributor

@Zimmi48 done (#6963). I don't know which labels to use though, and whom to assign. I hope I got the milestone right :D

@ppedrot ppedrot deleted the export-options branch March 27, 2018 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: feature New user-facing feature request or implementation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants