Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2592

Quick migration guide to uncurried mode for PPX maintainers?

$
0
0

I see that they’re in the Rescript compiler source code. I know the purpose of the @res.arity decorator, to tell the compiler what we expect the arity of the function to be, but I don’t know the actual behavior. If I have a function with 4 params, and I decorate with @res.arity(2), will the first two params be treated as a single function, and the last two params become curryable? In any case, I expect that my fix will be to always have the arity match the number of args in order to make uncurried functions.

The @res.uapp decorator, is that the inverse companion? Is this telling Rescript to package all of the function parameters up as a single tuple on the backend function invocation?

I’ve never authored a PPX from scratch before, but I’m trying to update one to work with Rescript 11, hence the questions. Thanks for your patience.

@alex.fedoseev the examples you wrote above are in Rescript, but that’s not what your PPX actually does under the hood, right? It seems to me like the PPX runs on the OCaml AST level, after Rescript has parsed and transformed the syntax but before the compiler is run, but I’m not sure.

Your tips on your workflow for upgrading your PPX were helpful. Thank you!


Viewing all articles
Browse latest Browse all 2592

Trending Articles