Add support for syntactic command arguments #893
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
The core of the change is the new support for passing arguments to commands in syntactic, i.e. uninterpreted, form. The main use cases for this is are:
The change also introduces a
@no-coercion!
macro and option that is honored by the new primitives as well aselaborate-skeleton
andelaborate-ty-skeleton
.On the OCaml side, there is a new helper function called
diag_error_lazy
that reduces the noise of around diagnostics a little bit. I took the liberty to also use it in existing builtins.The entirety of the changes should be backwards compatible.
Notes / TODO
Vernacular Syntax
The
#[arguments(..)]
syntax has been generalized to accept the following values:syntactic
,elaborated
(the default)raw
(orunelaborated
for consistency)Examples
tests/test_API_elaborate.v
has a bunch of new test cases that try to cover some of the possible use cases.API
To keep the changes to commands minimal, the type of syntactic arguments,
syntax.argument
, is embedded into the normal argument typeargument
through a new constructor calledsyntax.arg
.syntax.argument
itself consists of several opaque sub types.There are a handful of operations and eliminators on syntactic arguments. They require a few concepts from Rocq itself to make sense.