-
Notifications
You must be signed in to change notification settings - Fork 667
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
Locating identifiers in a few plugin commands #13102
Locating identifiers in a few plugin commands #13102
Conversation
871ad7c
to
6b05711
Compare
6b05711
to
3cead3e
Compare
3cead3e
to
07604fc
Compare
07604fc
to
da1dbd1
Compare
This uniformly adds a location to identifiers at parsing time and it seems basically ready for a (trivial) review. The dpdgraph and macosx CI errors are unrelated. |
interp/stdarg.mli
Outdated
@@ -37,6 +37,8 @@ val wit_int_or_var : (int or_var, int or_var, int) genarg_type | |||
|
|||
val wit_ident : Id.t uniform_genarg_type | |||
|
|||
val wit_identref : lident uniform_genarg_type |
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.
This is only used in VERNAC EXTEND afaict, so there is no need for the toplevel value type. It could be set to Empty.t
or Id.t
. The last thing I want is to wantonly start using locations in the runtime representation of data that shouldn't be located, so better prevent this statically.
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.
da1dbd1
to
e85fca8
Compare
Does this pull request only need a rebase or is there more to it? There have been no changes since 8.13. |
@silene I don't agree with the idea that adding locations to runtime values is a good thing. I've already argued several times offline that it did not make sense, since locations are only meaningful for code / closures that are going to be executed in debug mode, not for stuff which is already computed. |
Somehow, this was related to #13103 about which no conclusion was found with @ppedrot (basically, the unresolved question is: how deep is it morally justified to propagate a location so as to locate error messages vs polluting a code which per se is conceptually unrelated to parsing). But if @ppedrot agrees, I can just do the change he suggests and have the current PR merged. |
What is not clear though is whether you agree that when a location is meaningful (at least in strict mode), it is useful for a user to have it? |
@herbelin I think I managed once to convince you that it did not make sense to attach locations to runtime values, but that instead it should be attached to the code manipulating them. Since it looks like either I have dreamt or you have forgotten about it, let me rehash the arguments. Assume you have tactic Consider the following situations:
Now, what do you underline? If you believe locations are attached to values, you don't have much choice and a best effort solution means that you won't underline anything, except for case 1 and maybe 2. If you tell me that one instance of these should underline the syntactic argument of I personally believe that in all these cases we should underline the syntactic argument, because this is the only thing that makes sense in general. The worst part of this observation is that it is actually easy to do (in Tacinterp). But this PR does not make any progress on that front. Worse it is randomly polluting the runtime with irrelevant data. |
@ppedrot: I think you meant #13100 and #13103 in your last comment. This PR (#13102) is about the use of About #13100 and #13103, there is no urgency for discussing them right now, but we should eventually separate the issues. The question of locating evaluated tactic expressions is taking all the place in the discussion while 1) I agree with the issue that you're raising 2) this was not the primary objective of this set of PRs and I'd suspect that you are not opposed to the primary objective.
About #13100 and #13103 and your examples, I can imagine different localization strategies but why not locating the syntactic argument ( Now, if the question of locating errors in Ltac is too complex, it might be wise to postpone it so that it does not block the original goal (1.). It makes me sad, because it is a renouncement to address an interesting issue without even a vision on how we could resolve it in the future, but that could also be reasonable (in which case I would reduce #13100 and #13103 to only their grammar part). |
Indeed, I got a bit carried over. This PR is precisely the fragment of the original PR I completely agree with (modulo code nits from the review). To reassess my position:
Yes.
All the problem with this question is concentrated in the proviso. Except for vernacular commands, the relevance of the location quickly vanishes when used in a language that lets you manipulate values, be it Ltac1 or Ltac2.
Yes, sorry, this PR can go in. (If you can fix the nits that would be better but my quota of ranting was exhausted with this one.) |
e85fca8
to
76eb0fd
Compare
76eb0fd
to
c431f34
Compare
@ppedrot: thanks for your answer! I changed the glob of While at it, I added a dependency on #14442 which adds the infrastructure to locate constants in extraction error (the previous version of the PR was using the location at a useless place actually). @silene: I postponed to 8.15. It is better if the whole set of PRs go altogether. |
Kind: infrastructure.
This is part of the project started in #11842.
We add locations to identifiers in a couple of grammars of plugins in anticipation of identifying
Prim.identref
andPrim.ident
, with the latter eventually taking a location by default and the former being eventually deprecated.