ppxlib icon indicating copy to clipboard operation
ppxlib copied to clipboard

Metaocaml attributes

Open Drup opened this issue 7 years ago • 2 comments

Recent versions of metaocaml mark quotations and splicing using ppx attributes. For example .< e >. is desugared at parsing time in e [@metaocaml.bracket].

ppxlib doesn't seem to recognize them, and complain loudly about them being unused. It would be nice to recognize them, and let them pass through to the (modified) typechecker.

I got the issue with ppx_sexp_conv, but I figured this is the right repository for this.

Drup avatar Oct 07 '18 18:10 Drup

You can add metaocaml to the hard-coded list of reserved namespaces here. You can also reserve it on the command line by passing -reserve-namespace metaocaml to the ppx driver: (preprocess (pps ppx_metaocaml -- -reserve-namespace metaocaml)).

We also added better support for machine generated attributes: all attributes starting with _ are silently ignored by ppxlib. So if metaocaml generates [@_metaocaml.bracked], ppxlib will silently ignore this attribute.

ghost avatar Oct 08 '18 09:10 ghost

cc @yallop, who might be interested.

In the meantime, we should probably add it to the reserved namespaces.

Drup avatar Oct 08 '18 12:10 Drup