Remove reference name type.#7797
Conversation
3bfff1d to
d98c2d7
Compare
d98c2d7 to
fed3bd7
Compare
|
|
||
| type qualid | ||
| type qualid_r | ||
| type qualid = qualid_r CAst.t |
There was a problem hiding this comment.
Why do we now expose this?
There was a problem hiding this comment.
We don't expose more, qualid_r is the old qualid and the new qualid was used in ad-hoc ways in many places.
herbelin
left a comment
There was a problem hiding this comment.
At some time, the parser was building Qualid only with non-empty path (and probably it is still the case, at least in g_prim.ml4), so in practice, even if not enforced by the OCaml syntax, I would suspect that the invariant was satisfied and that no collision even happened.
On the other side, if I remember correctly, the only real interest in differentiating between Ident in Qualid was for Constrintern (intern_applied_reference, find_pattern_variable, ...). The test qualid_is_ident is as good with this respect.
If I understand correctly, you are keeping the difference between the concept reference (in the sense of ast-level version of GlobRef.t/variable) and the technical incarnation of this concept (an uninterpreted list of identifiers). Seems good.
So, altogether, I find that this PR makes sense (with the usual reserve of the opinion of plugin developers, but that's routine!).
gares
left a comment
There was a problem hiding this comment.
Correct wrt ssr & ide.
If possible I'd made qualid a module and have Qualid.is_ident and Qualid.basename for example. But I was born with C, so I'm also fine with qualid_ ;-)
reference was defined as Ident or Qualid, but the qualid type already permits empty paths. So we had effectively two representations for unqualified names, that were not seen as equal by eq_reference. We remove the reference type and replace its uses by qualid.
fed3bd7 to
61c7a4b
Compare
|
@silene you're the owner of |
|
In fact, @gares is the secondary owner and already approved it. So the only remaining step is to provide overlays for all plugins. |
|
I've only checked ssr and ide as my review says. Which other files do you want me to check? |
|
I think the idea is that the owner of |
|
@ppedrot In Ltac2, I read: (** Beware, at the raw level, [Qualid [id]] has not the same meaning as
[Ident id]. The first is an unqualified global reference, the second is
the dynamic reference to id. *)which seems completely contradictory with the whole point of this PR. Can you explain a bit more? |
|
@maximedenes That's just Ltac2 wrongly exploiting the difference between both representations. I need to fix that separately. |
Ok, so I will submit a first blind patch that makes it compile, and will let you fix the semantics. |
|
Can't you provide a compatibility layer for plugins? |
For now, I prefer to see errors on plugins that I plan to port myself, because there is already an ocean of deprecation warnings produced by plugins we track on CI. But once that is done, I would be happy to implement a layer. Do you have a suggestion on how to do that? |
|
You can maybe make |
|
I am also not sure I am a fan of the new naming, as |
I think it is pretty standard that qualified identifiers allow empty prefixes, isn't it? |
Not in Coq I think. |
|
@maximedenes Ltac2 made not to observe this difference. |
4ec7f4f to
133ac4f
Compare
|
Ok, I ported all plugins. A side remark: having more uniform build systems for all those plugins wouldn't hurt. I hope the naming issue is not blocking, as far as I'm concerned, this PR is ready modulo CI. |
Can you give an example where the syntax imposes qualification. I don't think it is the case. |
Indeed, in the refman the notion of qualid is a superset for the notion of ident: https://coq.inria.fr/refman/language/gallina-specification-language.html#grammar-token-qualid |
Oh indeed you are right, |
|
@maximedenes can you ping the upstreams you made an overlay, I've to leave the lab now |
Sure, thanks for merging! Maybe I don't need to ping you, though ;) |
|
Hi, I noted a regression introduced by this PR. At the time of printing, the information of whether we have a variable or a global reference seems to be lost. This is visible for instance by the loss of color when printing a constant or inductive or constructor. Example: I don't know what would be the easier to fix it. At parsing time, we are not able to make the difference, but starting with the translation |
|
Hi, I'd like to understand better. How was the distinction between variables and global references done previously? |
|
I think it was |
|
@maximedenes: Maybe a cool way to fix the problem while at the same time making and in the case of reference, there could be a An alternative fix would be to add a field What do you think? |
And what would that field mean in all other constructors of the AST? |
It is an optional field, to give a possible alternative rendering (to be then propogated to |
Adapt to Coq's PR rocq-prover#7797 (removal of reference).
referencewas defined asIdentorQualid, but thequalidtype alreadypermits empty paths. So we had effectively two representations for
unqualified names, that were not seen as equal by
eq_reference.We remove the reference type and replace its uses by
qualid.This is still work in progress. We need to:
qualid_is_ident