-
Notifications
You must be signed in to change notification settings - Fork 39
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
metaquot feature request: literal quotations #83
Comments
@gasche Thank you for filling this issue.
You mean a question mark, I suppose. |
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
Implements (partially) ocaml-ppx#83.
The PR #84 implements (partially) the proposition for OCaml 4.11. I will make PRs for other versions once this one will be reviewed. Note that I didn't think about that but it seems |
Implements (partially) ocaml-ppx#83.
The payload of
Pconst_*
nodes in the Parsetree is changing on a regular basis: Pconst_int changed, now it is the turn of Pconst_string, etc. Having support for literal quotation would be nice as it would let us write version-robust code to create literals or pattern-match on them, in the simple case where we don't need all the data/knobs of the full datatype. (Typically to parse attribute information encoded in literals.)( @thierry-martinez and myself were discussing this is ocaml-ppx/ppx_deriving_protobuf#36 (comment) )
I would propose the following interface:
[%lit.{integer,int,int32,in64,nativeint,float,char,string} <payload>]
, available in both expressions and patterns (with a question mark). This is one quotation per constructor in theAst_helper.Const
module (suggestion from @thierry-martinez), and I would propose to use the same payload type as the non-default parameter of the constructor (in particular,string
for%lit.integer
andint
for%lit.int
).The text was updated successfully, but these errors were encountered: