-
Notifications
You must be signed in to change notification settings - Fork 647
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
Make Cumulative, NonCumulative and Private attributes. #11665
Conversation
I'll wait for #11423 to be merged before I document this PR. |
@ppedrot This PR introduces the |
I think it's fair enough to say that Private Inductive is about not exporting something from the module. |
I also think this is much more standard in CS than the abusive use of "private" in the HoTT community. |
OK, I don't know what the use of "private" in the HoTT community is, but if this |
I think there's a misunderstanding (but I'm not fully sure), so let's try to clarify: a |
OK thank you very much for clearing things up. So private inductive types are a form of abstraction but more limited than the standard meaning of private. It is similar to types that are exported without their definition in OCaml. What about making the attribute |
It's the elimination which is restricted, not the construction. |
OK. Please advise a good name. |
Private is fine imo |
But @maximedenes doesn't agree (and indeed using |
Not at the moment, but please don't use private. Not only it will clash with private in the abstraction meaning, but it also clashes with the OCaml notion of private sum type, which ironically is the dual (they can be destructed but not constructed from outside). |
I won't oppose to |
New version uses Still need to write tests, doc, and a changelog entry. |
The documentation is still a work-in-progress (I still want to move the definition of the template and program attributes) but already gives a pretty good idea of the final result. |
@ppedrot Unfortunately, I couldn't make the |
Thanks. FWIW, I try to avoid DELETENT when I can because it's not too safe with respect to future grammar changes that add additional productions to the nonterminal. It's safer to delete each production explicitly with
This form is a bit safer (when applicable) because just by looking at it, you can easily verify that this doesn't alter the language accepted:
SPLICE and RENAME are always safe. Later on I'll look at improving the edits/edit operations to make them simpler/safer with respect to changes. |
@Zimmi48 is that merely a parsing problem? In particular, could that be solved using some ad-hoc lookahead? |
@ppedrot I thought that lookaheads could help but I don't know how to use them. |
Everyone on Gitter seemed to prefer |
- Legacy attributes can now be specified in any order. - Legacy attribute Cumulative maps to universes(cumulative). - Legacy attribute NonCumulative maps to universes(noncumulative). - Legacy attribute Private maps to private(matching). We use "private(matching)" and not "private(match)" because we cannot use keywords within attributes.
And fix documentation following the removal of the Template Check flag in coq#11546.
following changes to attribute parsing.
Unfortunately, we cannot go further and parse Export as a legacy attribute because this syntax conflicts with the Export command.
23a0581
to
4b37834
Compare
This is ready. Can I get an assignee? |
You define a lookahead function and then use the function name in the production. The following example succeeds for the input
|
Thanks. I tried using a lookahead but didn't manage to fix the issue. But anyway, this wouldn't provide much advantage because |
As this PR changes quite a lot of things in quite a number of places, I hope I won't have to wait for too long before it gets an assignee and eventually gets merged. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't check the documentation changes thoroughly, but the changes to the code look OK to me. I am a bit surprised you managed to sort the parsing issues without breaking everything, but the CI seems to be fine, so that's probably correct.
Let's merge, this PR has been discussed viva voce already, I don't think there is much point in delaying it further. |
Thanks @ppedrot! |
Kind: feature
These are the last morally attributes which were not parsed as such.
Note that initially I wanted to make the new attributes
universes(polymorphic(cumulative))
anduniverses(polymorphic(noncumulative)
(since these attributes must be provided in a polymorphic context). But I didn't manage to find a solution that would be backward-compatible.