Skip to content
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

ppx is skipped when (modes byte) #9650

Open
zbaylin opened this issue Jan 6, 2024 · 4 comments
Open

ppx is skipped when (modes byte) #9650

zbaylin opened this issue Jan 6, 2024 · 4 comments
Labels

Comments

@zbaylin
Copy link

zbaylin commented Jan 6, 2024

Expected Behavior

I define a ppx which is expected to compile only as a bytecode library:

(library
 (name my_ppx)
 ...
 (kind ppx_rewriter)
 (modes byte))

I expect this to be applied to my code which depends on my_ppx as a preprocessor

...
  (preprocessor (pps my_ppx))
...

Actual Behavior

The ppx is not applied to the code and extension points remain. This is not the case if I remove the (modes byte).

Reproduction

See above

Specifications

  • Version of dune (output of dune --version): 3.12.1
  • Version of ocaml (output of ocamlc --version): 4.14.1
  • Operating system (distribution and version): macOS Big Sur
@rgrinberg rgrinberg added the bug label Jan 6, 2024
@rgrinberg
Copy link
Member

Thanks for the report. I reproduced the bug here #9653

What would be the behavior that you would expect?

  1. An error telling the user that a native driver could not be built
  2. Transparently switch to a bytecode driver. This might create a preprocessor that is slower.

@zbaylin
Copy link
Author

zbaylin commented Jan 7, 2024

Hi @rgrinberg, thanks for helping reproduce the bug.

In my opinion, dune should switch to a bytecode-based driver, or maybe even provide a way of specifying which ppxs to run under bytecode/native mode in the preprocessing atom.

The ppx I'm running depends on being run under the bytecode runtime, and I'm willing to accept the performance trade off to run it.

@rgrinberg
Copy link
Member

Okay, switching to bytecode sounds reasonable enough. Do you want to try implementing this?

@zbaylin
Copy link
Author

zbaylin commented Jan 12, 2024

Sure, I can look into it. Do you have any pointers as to where I should look for code regarding ppx building/execution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants