-
Notifications
You must be signed in to change notification settings - Fork 67
Add support for syntactic command arguments #893
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
base: master
Are you sure you want to change the base?
Conversation
3f5780e to
0cfdf47
Compare
0cfdf47 to
914f603
Compare
|
Thanks, overall looks pretty good! A few improvements I'd like to see before a merge.
|
|
There is a design choice we have to make. When you write Otherwise even when syntactic arguments are on you can't use Rocq's number/string parser without putting If we got this way, reusing the |
|
Also, I think these new builtins should be in their own section, i.e. not in utils (see the |
This is something I had in mind but didn't get to yet. To me it seems easiest to offer functions of type |
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-skeletonandelaborate-ty-skeleton.On the OCaml side, there is a new helper function called
diag_error_lazythat 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(orunelaboratedfor consistency)Examples
tests/test_API_elaborate.vhas 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 typeargumentthrough a new constructor calledsyntax.arg.syntax.argumentitself 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.