janestreet / ppx_optcomp

Optional compilation for OCaml
MIT License
65 stars 18 forks source link

Use with other PPX's #9

Closed zbaylin closed 4 years ago

zbaylin commented 4 years ago

Hello, I have a separate PPX called ppx_os (Rolltrax/ppx_os) that I would like to use in conjunction with ppx_optcomp.

If I have this in ocaml:

[%%define os [%operating_system]]

I get the error

Error: optcomp: expression not supported

I was under the assumption that I could use ppx_optcomp with other ppx's to determine things like environment variables and the like. Am I mistaken, is my syntax wrong, or is there something else that I'm missing?

Thank you!

lpw25 commented 4 years ago

ppx_optcomp deliberately registers itself as a preprocessing pass with ppxlib, so that it is run before other ppxes. My understanding is that this is so that attributes and extensions that are dropped by conditional compilation are not processed by other ppxes (where they might error).

I think this is unlikely to change, so I'm going to close this issue. Sorry for the slow and not particularly helpful response.

zbaylin commented 4 years ago

No worries, that's helpful information. Thanks!