-
Notifications
You must be signed in to change notification settings - Fork 640
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
Remove section paths from kernel names #8555
Conversation
Looks broken... |
you need to fix dev/*ml stuff to :-/ |
329d7d1
to
b7b61f3
Compare
Can you explain your goals? Is it intended to be a purely internal cleaning or with a change of semantics in mind? For instance, does this have an impact in what |
It is not fully internal, because it prevents for example: Ltac f := idtac.
Section foo. Ltac f := idtac. End foo. which was previously allowed. I didn't find an occurrence, except one in the test suite. But overall, it does not change much the semantics of names at the user level. After this patch, However, I was very surprised to discover one can qualify using section paths (and not just module paths), I'm not sure how aware users are of this feature. We may want to discuss it separately. |
So the answer is I'm trying to clean (parts of) the section-related code, and save some memory. |
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 am supporting this change. It makes the kernel cleaner and reduces many places where we can break invariants while not removing any user-facing feature.
(** Projections *) | ||
|
||
val user : t -> KerName.t | ||
val canonical : t -> KerName.t | ||
|
||
val repr3 : t -> ModPath.t * DirPath.t * Label.t | ||
val repr2 : t -> ModPath.t * Label.t |
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.
Should probably be called repr
.
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 doubt it, because repr
should return the two names...
kernel/term_typing.ml
Outdated
let (_, dir, _) = Constant.repr3 kn in | ||
let hcons = DirPath.is_empty dir in | ||
(* let (_, dir, _) = Constant.repr3 kn in *) | ||
let hcons = false (* XXX DirPath.is_empty dir *) in |
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.
Isn't that preventing section definitions from being hashconsed when they exit it?
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.
In fact now that we don't have to change the names I think we could just hashcons when the cooking_info
is empty.
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.
Indeed.
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.
Isn't that preventing section definitions from being hashconsed when they exit it?
Yeah, I completely forgot to come back to this part of the code, sorry.
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.
Isn't that preventing section definitions from being hashconsed when they exit it?
In fact, I don't think so because the only call to translate_recipe
already hash conses everything (body, type, universes)...
Can you confirm?
@@ -92,8 +92,7 @@ let subst_keys (subst,(k,k')) = | |||
(subst_key subst k, subst_key subst k') | |||
|
|||
let discharge_key = function | |||
| KGlob g when Lib.is_in_section g -> | |||
if isVarRef g then None else Some (KGlob (pop_global_reference g)) | |||
| KGlob (VarRef _ as g) when Lib.is_in_section g -> None |
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.
Is there still a need for the when
?
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 don't know, the logic is pretty mysterious to me, so I kept the behavior of the original code.
OK, I think I now understand. One reason I'm worrying is that I feel that there is a general confusion about where to go with discharge and with overwriting the name of section variables in goal, a sea snake which blocks us to make progresses (e.g. with |
I'm pretty sure discussion on these points is needed indeed, and you can open an issue about it. But as far as I can tell, this patch is completely orthogonal to these questions. |
756d69a
to
05ebff8
Compare
This is blocking on a fiat-crypto-legacy failure, but building it on my machine takes ~2h before I see the first |
Ok, you're asking me to describe the previous design but I failed to understand it, so I'll let you amend the commit message in the way you like. I anyway exhausted the time I was planning to spend on this patch, and as mentioned above, I don't need it at all. |
Does that mean that you don't understand what this patch does?
I am very puzzled with this statement, which does seem wrong at several levels. If you, the author of the patch, and maintainer of the subsystem in question, has deep trouble writing a short paragraph that documents the change for those doing |
Exactly. |
Well, it's pretty clear: there is legacy code in the kernel that is essentially dead in a non-trivial way. So it doesn't hurt removing it, it makes the kernel more robust and reduces its attack surface. |
I'm fine with this patch. |
@ejgallego are you reassured and OK for the PR? |
Sure, I have nothing against the PR, which seems very welcome, I just said that the commit message could be a bit better than empty IMO. Give me a few minutes and I'll prepare a commit message then, given that I am supposed to do it, it seems. |
This comment has been minimized.
This comment has been minimized.
Sorry for the delay, here it goes:
|
We remove sections paths from kernel names. This is a cleanup as most of the times this information was unused. This implies a change in the Kernel API and small user visible changes with regards to tactic qualification. In particular, the removal of "global discharge" implies a large cleanup of code. Additionally, the change implies that some machinery in `library` and `safe_typing` must now take an `~in_section` parameter, as to provide the information whether a section is open or not.
e75dfba
to
650c65a
Compare
Thanks, commit updated. |
CI failures are spurious, right? Iris is broken in master already... |
Yup, CI here is good. However, this got bitten by the |
lol |
No rebase, the guy that merges should take care of the conflict. |
I am confused or was this PR merged without the overlays having been properly submitted as PR @ppedrot ? Anyways, CI in master is broken so please @maximedenes submit the corresponding PRs and @mattam82 @ppedrot merge, thanks. |
Also not sure about the deprecation policy followed here. |
Strange, the merge script didn't warn me that there were overlays, and I forgot to check that there were there indeed. I can merge the Ltac2 one quickly, and submit one in equations.
API changed in a non-backward compatible way, I don't think we can easily provide a deprecated interface. |
PR submitted on equations and already merged in Ltac2. |
Yep, I did provide one deprecation warning for the construct for which I could see a transition path. |
Cool, thanks @ppedrot |
Let's see what CI says.
API documentation needs to be updated, and
dev/doc/changes.md
to mention a few renamings.