ocaml-ppx / ppxlib

Base library and tools for ppx rewriters
MIT License
244 stars 94 forks source link

Exp.fun_ appears to be unbound using ocaml 5.2 and ppxlib 0.32.1 #491

Closed nickbetteridge closed 1 month ago

nickbetteridge commented 1 month ago

I'm using ocaml 5.2 and ppxlib 0.32.1 - Exp.fun_ appears to be unbound. As far as I can see, the rest of Exp.* are visible.

nickbetteridge commented 1 month ago

On further investigation, the referenced lib is compiler-libs.common, with Parsetree, Ast_helper and Asttypes being openned - I guess I should be chasing the compiler guys?

nickbetteridge commented 1 month ago

Ok, so it appears that Exp.fun_ is no longer in 5.2 [1], whereas it was in 5. [2] - I'll ask the compiler guys

[1] https://ocaml.org/manual/5.2/api/compilerlibref/Ast_helper.Exp.html [2] https://ocaml.org/manual/5.1/api/compilerlibref/Ast_helper.Exp.html

NathanReb commented 1 month ago

In which context did you run into this? This sounds like you are not using Ppxlib.Ast_helper but the compiler-libs version instead.

Note that ppxlib uses a fixed AST version internally rather than the one from your installed compiler to ensure to compat with a range of compilers.

Trying to use the compiler-libs to generate AST nodes when writing a ppx likely won't compile as it might not be the version ppxlib's expecting, especially if you are on OCaml 5.2 since ppxlib uses the 4.14/5.0 ast internally.

nickbetteridge commented 1 month ago

Yes, you're quite right - my mistake. Until Friday, I had exclusively used ppxlib. Then, recompiling a set of foreign libs for 5.2, the error was thrown and, without checking the dune file and assuming it was ppxlib, I created this issue. It is indeed the compiler-libs version - the context isn't ppxlib, but a standalone generator. My apologies. Ppxlib remains an excellent library :) Please feel free to re-close this. Thanks Nathan

NathanReb commented 1 month ago

No problem! Closing!